views:

38

answers:

2

I've been exploring ideas how to create thumbnails from a user upload and store them in a directory and then use that thumbnail to display the original. I've been reading posts about phpthumb(), wideimage, imagemagick, and php's GD.

I need some advice on which would work best for my requirements.

When the user uploads a source photo to the website I want to create a thumbnail and store it in a thumbnial directory. I want to resize the main file to say 600px. or whatever. I want the thumbnail image to have rounded corners with a dropshadow. For displaying the photogallery I was thinking about using VisualLightbox as it has many different options for displaying a gallery that I liked, but in order to use this I have to be able to create my own thumbnails.

I was leaning towards phpthumb() because of the rounded corners and dropshadow effect, but it looks like it creates the thumbnail on the fly based on the source image...does it give me the option to store the image on the file system and then point to it in the html? The other downer was a recent post that saind phpthumb() was not compatible with PHP 5.3. I liked WideImage for its simplicity, but it didn't offer rounded corners or drop shadow (I did find a jquery plugin that I could use for the dropshadow)...what are your thoughts and suggestions?

thanks.

A: 

If you can display it on the browser, you can capture the output and save to a file.

I am not sure how phpthumb() works, but there is certaintly a function that sends the compressed thumbnail to the browser. You want to invoke this function, and capture its output using output buffereing. Obeserve:

ob_start(); // begin output buffering
code_to_generate_and_display_thumbnail();
$thumbnail = ob_get_contents(); 
ob_end_clean();

file_put_contents("images/mythumb.jpg",$thumbnail);
Byron Whitlock
how?...not sure I know what you mean? Do you have a code example you could show me what u mean?
Ronedog
updated with an example...
Byron Whitlock
A: 

Thanks byron. I ended up going with WideImage and then modified the image display with jquery and my own borders. WideImage was easy to implement. thanks

Ronedog