note 27737 added to function.imagecopyresampled

From: Date: Tue, 17 Dec 2002 11:37:03 +0000
Subject: note 27737 added to function.imagecopyresampled
Groups: php.notes 
Request: Send a blank email to php-notes+get-41009@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.imagecopyresampled.php http://master.php.net/manage/user-notes.php?action=edit+27737 http://master.php.net/manage/user-notes.php?action=delete+27737 http://master.php.net/manage/user-notes.php?action=reject+27737

« previous php.notes (#41009) next »