|
Posted by Oli Charlesworth on 10/08/06 14:21
ZabMilenko said the following on 08/10/2006 14:55:
> Here is what I am seeing:
>
>
> while($filename=mysql_fetch_array($result))
> {
>
> for($i=0;$i<=count($filename);$i++)
> {
> // loop thru a bunch of files
>
> list($width, $height) = getimagesize($filename[$i]);
> // find out how big it is
>
> // Make an new image IN MEMORY
> $image_p = imagecreatetruecolor($new_width, $new_height);
>
> // make an image IN MEMORY from the original
> $image = imagecreatefromjpeg($filename[$i]);
>
>
> // Paint the image as a thumbnail IN MEMORY
> imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width,
> $new_height, $width, $height);
>
>
> // Send the new image to the browser
> imagejpeg($image_p, null, 100)."\n";
> imagedestroy($image);
> imagedestroy($image_p);
> }
>
> // Repeat
> }
>
> The problem is you can only send one image per request. That is ONE image
> between header("content-type ...") and imagejpeg()
>
> You can make all you want, but only the first will go to the browser.
> The rest is as useless as spam.
>
> So you need to dump the thumbnails to disk and load them another way.
Or have the script only output one image, and call it N times, i.e.:
<img src="script.php?img=1">
<img src="script.php?img=2">
<img src="script.php?img=3">
<img src="script.php?img=4">
[Back to original message]
|