PLEASE NOTE: This article may be out-of-date. Please visit the Support site for the latest information.

A PHP5 Interface Class That Will Work With Any Application

15 posts / 0 new
Letzter Beitrag
Anonymous

Code sample calls, and simple test form:

http://www.entraspan.com/blog/stw.html

I was hammering Brandon on issues with his sample code, so he asked me to post what I had .. which meant i had to document it.

This is different from the other samples, in that it only handles the retrieval and caching of thumbnails. It is up to the calling application to decide what to do if an image is not available and to produce the html code, but that is the way it should be.

btw, that page shows the actual code from my php utilities, that is in production use. An example of an application that I am using the thumbnails in:

http://www.koaladir.com/demo/phpld.php

Bild von puravida
puravida
Jedi Warrior
Online
Beigetreten: 09/01/2007
Besuchen puravida's Webseite

Very cool, koaladir. Thank you.

Also, your alpha app really looks good. Great way to see what you're working with!

The only correction I have is that you can also use "xlg" to get the largest default size at 320x240.

Great work on the class, by the way.

Ciao,

Brandon

Anonymous

Ahh, xlg, i like! Using thumbnails for visual confirmations just got a whole lot nicer..

Bild von puravida
puravida
Jedi Warrior
Online
Beigetreten: 09/01/2007
Besuchen puravida's Webseite

Hey Koaladir,

I just remembered to mention that you named your pages and link on your site "Share The Web" instead of "Shrink The Web"...

If you name them correctly, you might get more organic traffic from people searching for that type of query. We get a good bit of traffic monthly from people searching for "STW" or "ShrinkTheWeb" + (some code reference)

Just a thought...

Cheers,

Brandon

Anonymous

Thanks, I just updated the page titles, I can't tell you how many times i have typed that other url in by mistake, slow learner Smile

Anonymous

Hello,

This script looks like it does exactly what I need. I just don't understand how to call it.

Does the source call the class? I've been staring at the code and can't figure out how the source and the class interact, let alone how to call them to produce a cached thumbnail.

Any help would be very appreciated.

Thanks

Tim

Bild von puravida
puravida
Jedi Warrior
Online
Beigetreten: 09/01/2007
Besuchen puravida's Webseite

Good choice. This is a well written PHP5 class. Did you see the instructions at the entrepan website (i.e. link in the original post of this thread)??

If you go through that guide thoroughly, it may help you.

Anonymous

Hello,

Yes I did follow the link to entrepans website. Are these the instructions you are referring to? I have also read the code comments in great detail.

Quote:
I kind of beat them up over their sample code because it had a couple of minor errors in it, and turned out to not be directly usable for me, and they asked to post what I had, so here it is..

From playing with this, I now know xmax, ymax, embed, full, and scale all require an upgraded account. The value embed=0 is for standard xml, embed=1 dumps raw jpg data, and embed=2 some java script. Size is optional, and the value 'sm' is small, 'xlg' is x-large, any other value including 'lg' produces large.

Please understand I am not the type of person to just post on forums without first trying every avenue I see. Posting on a forum is truly the last resort.

I have gone through most of the forum threads to try and find some hints on how to implement this class, but so far have not found many clues. I have also been researching on implementing php classes, however this has proved too generic.

I will continue trying, perhaps some breakfast will help my thinking.

Thankyou for your patience.

Tim

Bild von puravida
puravida
Jedi Warrior
Online
Beigetreten: 09/01/2007
Besuchen puravida's Webseite
sitereview wrote:
Please understand I am not the type of person to just post on forums without first trying every avenue I see. Posting on a forum is truly the last resort.

No problem... I'm not trying to be difficult but just want to be sure.

Just to clarify some basics:

1. you will need to have a source file (something like the 'sample source' provided at the entrepan site)

2. you will need to include the 'AppSTW Class' file contents inside the source file OR you can save it onto your server and "include" it into the source file

After that point, it may not be so obvious on usage, so you basically need to know that once the AppSTW Class is available (however you chose to do it --i.e. #2 above), you can then use one of the following:

showImage("Direct Call Example", AppSTW::queryRemoteThumbnail($url, $args, true));
showImage("Cached Call Example", AppSTW::getThumbnail($url, $args));
showImage("Large Scaled Image", AppSTW::getLargeThumbnail($url, true, true));
showImage("Small Scaled Image", AppSTW::getSmallThumbnail($url, true, true));
showImage("Scaled Image", AppSTW::getScaledThumbnail($url, 640, 480));

Those will display the sample images as defined in the "showImage" function block. If you want more granular control for each call, you would need to call the queryRemoteThumbnail($url, $args, true) function directly and make the result equal some argument. That way, you can manipulate the output as needed. I would be more specific on that, but I haven't really delved into entrepan's code enough to do so.

Hopefully that helps?

Best regards,

Brandon

Anonymous

Hello,

Thank-you very much for helping me. It's so good to finally see some awesome looking thumbnails!

I have a quick question regarding:
$name = md5($url.serialize($args)).".jpg";
I'm just wondering why and whether we have to encrypt the filename to an MD5 hash?

Is this for security?

Thank-you very much again for your help.

Tim

Bild von puravida
puravida
Jedi Warrior
Online
Beigetreten: 09/01/2007
Besuchen puravida's Webseite
sitereview wrote:
I'm just wondering why and whether we have to encrypt the filename to an MD5 hash?

Is this for security?

You are quite welcome for the help.

And, yes, it is as you guessed, for security. Using MD5 hash for filenames will keep people from "leeching" off of your cached thumbnails. It probably wouldn't be a problem to just name them whatever URL you are calling but if you are concerned about "leeching", you can leave it as-is.

Cheers,

Brandon

Topic locked

ShrinkTheWeb® (About STW) is another innovation by Neosys Consulting

Kontakt | PagePix Benefits | Learn More | Our Partners | Datenschutzrichtlinie | Nutzungsbedingungen

©2014 ShrinkTheWeb. Alle Rechte vorbehalten. ShrinkTheWeb ist ein eingetragenes Handelszeichen von ShrinkTheWeb.