Example #1
0
     list($src_width, $src_height) = imgsize($File->get_full_path());
     if (!$resample_all_images && check_thumbnail_sizes($thumb_type, $thumb_width, $thumb_height, $src_width, $src_height)) {
         // There is no need to resample, use original!
         $err = $File->get_af_thumb_path($size_name, $mimetype, true, $size_x);
         if ($err[0] != '!' && @copy($File->get_full_path(), $err)) {
             // File was saved. Ouput that same file immediately:
             // note: @copy returns FALSE on failure, if not muted it'll print the error on screen
             $err = $File->output_cached_thumb($size_name, $mimetype, $mtime, $size_x);
         }
     } else {
         // Resample
         list($err, $src_imh) = load_image($File->get_full_path(), $mimetype);
         if (empty($err)) {
             list($err, $dest_imh) = generate_thumb($src_imh, $thumb_type, $thumb_width, $thumb_height, $thumb_percent_blur, $size_x);
             if (empty($err)) {
                 $err = $File->save_thumb_to_cache($dest_imh, $size_name, $mimetype, $thumb_quality, $size_x);
                 if (empty($err)) {
                     // File was saved. Ouput that same file immediately:
                     // This is probably better than recompressing the memory image..
                     $err = $File->output_cached_thumb($size_name, $mimetype, $mtime, $size_x);
                 } else {
                     // File could not be saved.
                     // fp> We might want to output dynamically...
                     // $err = output_image( $dest_imh, $mimetype );
                 }
             }
         }
     }
 }
 // ERROR IMAGE
 if (!empty($err)) {