Re: How to create thumbnails?
| From: | Seb Frost | Date: | Sun, 26 Aug 2001 18:34:28 +0000 |
| Subject: | Re: How to create thumbnails? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-64529@lists.php.net to get a copy of this message | ||
<?php
Header("Content-type: image/jpeg");
$src_img = imagecreatefromjpeg($fileURL);
$aspect=imagesy($src_img)/imagesx($src_img);
$new_w = $thumbSize;
$new_h = $new_w * $aspect;
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),i
magesy($src_img));
imagejpeg($dst_img,'',$quality);
?>
All you need to go is set up $fileURL and $thumbSize and this *should* work
flawlessly. When you get it working try using "Resampled" instead of
"Resized" - but you need gd 2.0.1 for that to work, and even then it has
issues it would seem.
- seb
-----Original Message-----
From: Jan [mailto:vincev@gmx.de]
Sent: 26 August 2001 18:22
To: php-general@lists.php.net
Subject: [PHP] How to create thumbnails?
For thumbnail creation I would need to know how I scale a loaded image or
better:
How do I copy a scaled version of an image created with imagecreatefromjpeg
onto a background I have previously created?
Jan