Jump to content

[SOLVED] Why doesn't script echo "thumbnail generated" while running through FOR loop..


cgm225

Recommended Posts

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;
            }
        }
    }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.