Re: Generate Thumbnail gif's
| From: | Curt Zirzow | Date: | Wed, 29 Oct 2003 06:49:50 +0000 |
| Subject: | Re: Generate Thumbnail gif's | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167973@lists.php.net to get a copy of this message | ||
* Thus wrote Leif K-Brooks (eurleif@buyer-brokerage.com):
> Vijaya_Manda wrote:
>
> >Is there any pre-written code available on the net to generate thumbnail
> >images for a picture.
> >I mean I send the path of the image and my PHP Script should be able to
> >generate a gif file of size 100x71 or something like that.
> >
> >
> Images will look stretched if you do that, but here are two functions to
> resize an image with a new width or height proportional to its current
> size. Pass them GD image resources created with imagecreatefrompng() and
> friends.
you could center a proportinal image onto a 100x71 background
image.
if (width > height) {
resize width to 100
resize height = height / (int) width/100
} else {
resize height to 71
resize width = width / (int) height/71
}
put resized image in center of 100x71 image.
Curt
--
"My PHP key is worn out"
PHP List stats since 1997:
http://zirzow.dyndns.org/html/mlists/