cgm225 Posted July 7, 2007 Share Posted July 7, 2007 The following FOR loop does not echo anything until it is complete. Is there a way to make it echo while it is executing, i.e. each time it passes through, echo the "thumbnail generated" statements? if ($action == "generate_all") { $image = 0; for($i = 1; $i >= 0; $i++) { buffer($image); if (file_exists("$photos_server_path/photos/$album/$buffer$image.jpg")) { echo "$buffer$image: "; if (file_exists("$photos_server_path/photos/$album/thumbnails/large_thumbnail-$image.jpg")) {} else { system("convert $photos_server_path/photos/$album/$buffer$image.jpg -resize 500x -quality 100 $photos_server_path/photos/$album/thumbnails/large_thumbnail-$image.jpg"); echo "Large thumbnail generated! | "; } if (file_exists("$photos_server_path/photos/$album/thumbnails/small_thumbnail-$image.jpg")) {} else { list($image_width, $image_height) = getimagesize("$photos_server_path/photos/$album/$buffer$image.jpg"); if ($image_height > $image_width) { $small_thumbnail_height = ceil(250 * ($image_width/$image_height)); } else { $small_thumbnail_height = ceil(250 * ($image_height/$image_width));} system("convert $photos_server_path/photos/$album/$buffer$image.jpg -resize 250x -gravity center -quality 100 -crop 250x$small_thumbnail_height+0+0 $photos_server_path/photos/$album/thumbnails/small_thumbnail-$image.jpg"); echo "Small thumbnail generated!<br>"; } $next_image_addage = $image; $image = $next_image_addage + 1; } else { $i = -5; } } } Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 7, 2007 Share Posted July 7, 2007 No. A php created page is not delivered to the browser until the script completes. You would have to involve some sort of AJAX solution to do what you propose. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.