NYCPHP Meetup

[nycphp-talk] Resample Image on the Fly

Ken Robinson kenrbnsn at rbnsn.com
Mon Jan 29 10:14:54 EST 2007


At 08:21 AM 1/29/2007, Randal Rust wrote:
>I need to find out if I can resample an image and also resample it
>using the GD Library. I don't seem to find anything that does it
>without creating and storing a thumbnail from the original image.
>
>Right now, I get an image and use getimagesize() to create new values
>for the height and width attributes. But that leaves an image that is
>less than perfect.
>
>I'd rather not store thumbnails of the images if I can avoid it, but
>maybe I can't.

If the images originated from a recent digital camera, a thumbnail 
image might be stored in the original image. Take a look at the 
exig_thumbnail() function <http://www.php.net/exit_thumbnail>.

If that is not the case, there are image resampling functions in the 
GD package. Take a look at the imagecopyresampled() function 
<http://www.php.net/imagecopyresampled>.

Ken 




More information about the talk mailing list