Re: Making Thumbnails
| From: | Chris Adams | Date: | Mon, 24 Jul 2000 20:12:38 +0000 |
| Subject: | Re: Making Thumbnails | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7958@lists.php.net to get a copy of this message | ||
> > I have a form where I allow a user to upload either a jpg, png, or
gif.
> > I'd like to have PHP automatically generate a thumbnail to scale;
however, I
> > don't know what function to use.
>
> There is no decent built in function to do this. I use the command line
> conversion tools from the pbmplus package.
I was planning on implementing a feature similar to this using the GD
library. Your comment makes me curious - what drawbacks would there be with
doing something like this:
ImageCreateFrom(GIF|JPEG|PNG)
ImageCreate (for the thumbnail)
Use GetImageSize to determine scaling and positioning (e.g. rather than
distorting, we'd like to center the image on a $Color background)
ImageCopyResized to copy from the source to the thumbnail
ImageJPEG to store the thumbnail somewhere in the webroot