note 6205 rejected from function.imagecopyresized by sander
| From: | sander@php.net | Date: | Sat, 06 Apr 2002 19:17:18 +0000 |
| Subject: | note 6205 rejected from function.imagecopyresized by sander | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-28762@lists.php.net to get a copy of this message | ||
To do the same with a JPEG, you must have PHP 3.0.16+ installed, and GD 1.8+. Here is a sample
<pre>
$src_img = imagecreatefromjpeg($imagefile);
$new_w = imagesx($src_img)/4;
$new_h = imagesy($src_img)/4;
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
imagejpeg($dst_img, "scratch/$imagefile");
echo "<img
src=scratch/$imagefile>\n";
</pre>