diff options
author | rvelices <rv-github@modusoptimus.com> | 2012-07-30 20:01:17 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2012-07-30 20:01:17 +0000 |
commit | 214a3c9dabe165f1042363dead3823d035cb60ee (patch) | |
tree | 46a8bd6f3c981b73028e9a9636ffff79d3ee53cd | |
parent | 26db3dde8fabd4b0a418f3835ad4a2064d2e8e1e (diff) |
bug 2712: Custom sized derivatives are never sharpened
git-svn-id: http://piwigo.org/svn/trunk@17230 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | i.php | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -299,7 +299,7 @@ function try_switch_source(DerivativeParams $params, $original_mtime) if ($use_watermark) { if (!isset($original_size)) - return; // cannot really know if a watermark is required + return false; // cannot really know if a watermark is required $dsize = $params->compute_final_size($original_size); $use_watermark = $params->will_watermark($dsize); ilog($use_watermark, $dsize); @@ -346,7 +346,9 @@ function try_switch_source(DerivativeParams $params, $original_mtime) $page['src_path'] = $candidate_path; $page['src_url'] = $page['root_path'] . substr($candidate_path, strlen(PHPWG_ROOT_PATH)); $page['rotation_angle'] = 0; + return true; } + return false; } function send_derivative($expires) @@ -515,7 +517,15 @@ else } mysql_close($pwg_db_link); -try_switch_source($params, $src_mtime); +if (!try_switch_source($params, $src_mtime) && $params->type==IMG_CUSTOM) +{ + $sharpen = 0; + foreach (ImageStdParams::get_defined_type_map() as $std_params) + { + $sharpen += $std_params->sharpen; + } + $params->sharpen = round($sharpen / count(ImageStdParams::get_defined_type_map()) ); +} if (!mkgetdir(dirname($page['derivative_path']))) { |