note 27736 deleted from function.unlink by imajes
| From: | imajes@php.net | Date: | Wed, 14 May 2003 01:06:03 +0000 |
| Subject: | note 27736 deleted from function.unlink by imajes | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-47936@lists.php.net to get a copy of this message | ||
Here's a nice simple sub for making resampled thumbnails to a certain size and leaving the
original next to it:
function uploadimg($image_path, $image_id, $file, $width, $height, $compression)
{
copy($file, "$image_path/$image_id.jpg");
$src_img = imagecreatefromJPEG("$image_path/$image_id.jpg");
$new_h = $height;
$new_w = $width;
$dst_img = imagecreatetruecolor($new_w,$new_h);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $new_w, $new_h, imagesx($src_img),
imagesy($src_img));
imagejpeg($dst_img, "$image_path/s_$image_id.jpg", $compression);
}
it's all pretty self explanatory :-)