Re: image calculation problem

From: Date: Wed, 13 Apr 2005 21:35:23 +0000
Subject: Re: image calculation problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-213036@lists.php.net to get a copy of this message
see below...
Basically I am trying to make a thumb where the width is 87px...I dont care what the height is, heres the code: function prop_thumb_height() { // The file $filename = 'cat.jpg'; // Content type header('Content-type: image/jpeg'); // Get new dimensions list($width_orig, $height_orig) = getimagesize($filename);
$width = 87; // note I'm not checking if $width_orig == 0 $scale_by = $width / $width_orig; $height = floor($height_orig * $scale_by + 0.5);
// Resample $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); // Output imagejpeg($image_p, 'ryan.jpg', 100); }


« previous php.general (#213036) next »