I am trying to have this function output data and the rescaled image after every loop but it doesn't display anything until it is finished looping through the complete array. I am assuming that this has something to do with the PHP image functions but is there a workaround?
function resize_images($images_l){
echo "Resizing Images<br>";
$new_height = 200;
$new_width = 200;
$c = 1;
foreach($images_l as $filename) {
echo "Image" . $c . "<br>";
$c++;
// Get the new dimensions
list($width, $height) = getimagesize($filename);
echo $new_width . ", " . $new_height . "<br>";
// Create the new image
$image_blank = imagecreatetruecolor($new_width, $new_height);
$baseimage = imagecreatefromjpeg($filename);
imagecopyresampled($image_blank, $baseimage, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Save the file
imagejpeg($image_blank, 's_' . $filename , 100);
echo "<img src=\"s_$filename\">";
}
return TRUE; }
Thanks