note 55529 deleted from function.imagejpeg by vincent
| From: | vincent@php.net | Date: | Sat, 06 Aug 2005 07:33:14 +0000 |
| Subject: | note 55529 deleted from function.imagejpeg by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-93154@lists.php.net to get a copy of this message | ||
Note Submitter: John Luetke <johnl1479 gmail com>
----
Rewrote the manual example into this function for creating a thumbnail image:
function thumbnail_jpeg ($original, $thumbnail, $width, $height, $quality) {
list($width_orig, $height_orig) = getimagesize($original);
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
}
else {
$height = ($width / $width_orig) * $height_orig;
}
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($originial);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagejpeg($image_p, $thumbnail, $quality);
return;
}