note 92638 deleted from function.imagejpeg by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 11:15:05 +0000 |
| Subject: | note 92638 deleted from function.imagejpeg by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197038@lists.php.net to get a copy of this message | ||
Note Submitter: someone at anydomain dot com
----
I am using the following function for creating thumbnail(s). it works fine. I just want all the
thumbnails a contant height so that they fit in a line. the only problem is that it can only output
one image to the browser only. how can it be used to output multiple images.
<?php
function resizeImage($originalImage,$new_height){
// Get the original geometry and calculate scales
list($width, $height) = getimagesize($originalImage);
$new_width = round(($width * $new_height) / $height);
// Resize the original image
$imageResized = imagecreatetruecolor($new_width, $new_height);
$imageTmp = imagecreatefromjpeg ($originalImage);
imagecopyresampled($imageResized, $imageTmp, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Output
imagejpeg($imageResized, null, 100);
imageDestroy($imageResized);
return;
}
resizeImage("IMG_0158.JPG",100); //this one shows on the browser
resizeImage("IMG_0159.JPG",100); //this one, and any subsequent ones, do not show up on
the browser
?>