Changeset 25793


Ignore:
Timestamp:
12/05/13 21:53:18 (6 years ago)
Author:
rvelices
Message:

fix 1 pixel rounding errors when generating multi size from another multi size

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/i.php

    r25385 r25793  
    285285{ 
    286286  global $page; 
    287   $original_size = null; 
    288   if (isset($page['original_size'])) 
    289   { 
    290     $original_size = $page['original_size']; 
    291     if ($page['rotation_angle']==90 || $page['rotation_angle']==270) 
    292     { 
    293       $tmp = $original_size[0]; 
    294       $original_size[0] = $original_size[1]; 
    295       $original_size[1] = $tmp; 
    296     } 
    297   } 
     287  if (!isset($page['original_size'])) 
     288    return false; 
     289 
     290  $original_size = $page['original_size']; 
     291  if ($page['rotation_angle']==90 || $page['rotation_angle']==270) 
     292  { 
     293    $tmp = $original_size[0]; 
     294    $original_size[0] = $original_size[1]; 
     295    $original_size[1] = $tmp; 
     296  } 
     297  $dsize = $params->compute_final_size($original_size); 
    298298 
    299299  $use_watermark = $params->use_watermark; 
    300300  if ($use_watermark) 
    301301  { 
    302     if (!isset($original_size)) 
    303       return false; // cannot really know if a watermark is required 
    304     $dsize = $params->compute_final_size($original_size); 
    305302    $use_watermark = $params->will_watermark($dsize); 
    306303  } 
     
    315312    if ($candidate->max_width() < $params->max_width() || $candidate->max_height() < $params->max_height()) 
    316313      continue; 
     314    $candidate_size = $candidate->compute_final_size($original_size); 
     315    if ($dsize != $params->compute_final_size($candidate_size)) 
     316      continue; 
     317 
    317318    if ($params->sizing->max_crop==0) 
    318319    { 
     
    324325      if ($candidate->sizing->max_crop!=0) 
    325326        continue; // this could be optimized 
    326       if (!isset($original_size)) 
    327         continue; 
    328       $candidate_size = $candidate->compute_final_size($original_size); 
    329327      if ($candidate_size[0] < $params->sizing->min_size[0] || $candidate_size[1] < $params->sizing->min_size[1] ) 
    330328        continue; 
Note: See TracChangeset for help on using the changeset viewer.