note 27736 added to function.unlink
| From: | richard at rack1 dot php dot net | Date: | Tue, 17 Dec 2002 11:35:28 +0000 |
| Subject: | note 27736 added to function.unlink | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41008@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 :-)
--
http://www.php.net/manual/en/function.unlink.php
http://master.php.net/manage/user-notes.php?action=edit+27736
http://master.php.net/manage/user-notes.php?action=delete+27736
http://master.php.net/manage/user-notes.php?action=reject+27736