Re: Image thumbnail creation
| From: | Ethan Schroeder | Date: | Mon, 09 Jul 2001 20:34:59 +0000 |
| Subject: | Re: Image thumbnail creation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56989@lists.php.net to get a copy of this message | ||
You must have the gd library compiled into PHP for this
http://www.php.net/manual/en/ref.image.php
<?
$directory = getcwd();
$directory = $directory."/photos";
$size = GetImageSize("$directory/$image"); // feed the name of the
original image here.
$width = $size[0];
$height = $size[1];
$new_w=100; // set this to what you want the new fixed-width to be
$ratio = $new_w/$width;
$new_h=$height*$ratio;
$dst_img=ImageCreate($new_w,$new_h);
$src_img=ImageCreateFromjpeg("$directory/$image");
ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),I
mageSY($src_img));
ImageJpeg($dst_img,"$directory/thumbnail.jpg",75);
?>
----- Original Message -----
From: "Steph" <steph@goamerica.net>
To: <php-general@lists.php.net>
Sent: Monday, July 09, 2001 11:27 AM
Subject: [PHP] Image thumbnail creation
> Hi all! New to the list and new to PHP. Im trying to create Image
thumbnail
> dynamically versus creasting them manually via my graphics program.
>
> Thanks,
> Steph
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>