Changeset 17229


Ignore:
Timestamp:
07/30/12 21:51:44 (7 years ago)
Author:
rvelices
Message:

bug 2711: Watermark is sometimes applied while it should not be

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/i.php

    r16989 r17229  
    284284{ 
    285285  global $page; 
     286  $original_size = null; 
     287  if (isset($page['original_size'])) 
     288  { 
     289    $original_size = $page['original_size']; 
     290    if ($page['rotation_angle']==90 || $page['rotation_angle']==270) 
     291    { 
     292      $tmp = $original_size[0]; 
     293      $original_size[0] = $original_size[1]; 
     294      $original_size[1] = $tmp; 
     295    } 
     296  } 
     297 
     298  $use_watermark = $params->use_watermark; 
     299  if ($use_watermark) 
     300  { 
     301    if (!isset($original_size)) 
     302      return; // cannot really know if a watermark is required 
     303    $dsize = $params->compute_final_size($original_size); 
     304    $use_watermark = $params->will_watermark($dsize); 
     305    ilog($use_watermark, $dsize); 
     306  } 
     307 
    286308  $candidates = array(); 
    287309  foreach(ImageStdParams::get_defined_type_map() as $candidate) 
     
    289311    if ($candidate->type == $params->type) 
    290312      continue; 
    291     if ($candidate->use_watermark != $params->use_watermark) 
     313    if ($candidate->use_watermark != $use_watermark) 
    292314      continue; 
    293315    if ($candidate->max_width() < $params->max_width() || $candidate->max_height() < $params->max_height()) 
     
    302324      if ($candidate->sizing->max_crop!=0) 
    303325        continue; // this could be optimized 
    304       if (!isset($page['original_size'])) 
     326      if (!isset($original_size)) 
    305327        continue; 
    306       $candidate_size = $candidate->compute_final_size($page['original_size']); 
     328      $candidate_size = $candidate->compute_final_size($original_size); 
    307329      if ($candidate_size[0] < $params->sizing->min_size[0] || $candidate_size[1] < $params->sizing->min_size[1] ) 
    308330        continue; 
     
    477499        $page['rotation_angle'] = pwg_image::get_rotation_angle_from_code($row['rotation']); 
    478500      } 
    479  
    480501    } 
    481502    if (!$row) 
Note: See TracChangeset for help on using the changeset viewer.