Example #1
0
 $Filetype =& $File->get_Filetype();
 // pre_dump( $Filetype );
 // TODO: dh> Filetype may be NULL here! see also r1.18 (IIRC)
 $mimetype = $Filetype->mimetype;
 // pre_dump( $mimetype );
 // Try to output the cached thumbnail:
 $err = $File->output_cached_thumb($size_name, $mimetype, $mtime, $size_x);
 //pre_dump( $err );
 if ($err == '!Thumbnail not found in' . $Settings->get('evocache_foldername')) {
     // The thumbnail wasn't already in the cache, try to generate and cache it now:
     $err = NULL;
     // Short error code
     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..