コード例 #1
0
ファイル: getfile.php プロジェクト: Ariflaw/b2evolution
 load_funcs('/files/model/_image.funcs.php');
 $size_name = $size;
 if (!isset($thumbnail_sizes[$size])) {
     // this file size alias is not defined, use default:
     // TODO: dh> this causes links for e.g. "fit-50x50" to work also, but with the drawback of images not getting served from the
     //           .evocache directory directly. I think invalid $size params should bark out here.
     // fp> ok.
     $size_name = 'fit-80x80';
 }
 if (!isset($thumbnail_sizes[$size_name][4])) {
     // Set blur percent in 0 by default
     $thumbnail_sizes[$size_name][4] = 0;
 }
 // Set all params for requested size:
 list($thumb_type, $thumb_width, $thumb_height, $thumb_quality, $thumb_percent_blur) = $thumbnail_sizes[$size_name];
 $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);