Changeset 14143


Ignore:
Timestamp:
Apr 14, 2012, 6:52:20 AM (8 years ago)
Author:
rvelices
Message:

bug 2615 php notice in calendar amd web service
multisize improve handling of cases where the original is smaller than a requested derivative, but rotation/watermarking is required

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/batch_manager_global.php

    r13651 r14143  
    735735
    736736  $query = '
    737 SELECT id,path,representative_ext,file,filesize,level,name
     737SELECT id,path,representative_ext,file,filesize,level,name,width,height,rotation
    738738  FROM '.IMAGES_TABLE;
    739739 
  • trunk/include/calendar_monthly.class.php

    r12922 r14143  
    351351    $page['chronology_date'][CDAY]=$day;
    352352    $query = '
    353 SELECT id, file,representative_ext,path,width, height, '.pwg_db_get_dayofweek($this->date_field).'-1 as dow';
     353SELECT id, file,representative_ext,path,width,height,rotation, '.pwg_db_get_dayofweek($this->date_field).'-1 as dow';
    354354    $query.= $this->inner_sql;
    355355    $query.= $this->get_date_where();
     
    393393
    394394    list($cell_width, $cell_height) = ImageStdParams::get_by_type(IMG_SQUARE)->sizing->ideal_size;
     395    if ($cell_width>120)
     396    {
     397      $cell_width = $cell_height = 120;
     398    }
    395399
    396400    $tpl_weeks    = array();
  • trunk/include/derivative.inc.php

    r13843 r14143  
    2727  public $id;
    2828  public $rel_path;
     29  public $rotation = 0;
    2930
    3031  private $size=null;
     
    5960      $height = $infos['height'];
    6061
     62      $this->rotation = intval($infos['rotation']) % 4;
    6163      // 1 or 5 =>  90 clockwise
    6264      // 3 or 7 => 270 clockwise
    63       if ($infos['rotation'] % 2 != 0)
     65      if ($this->rotation % 2)
    6466      {
    6567        $width = $infos['height'];
     
    174176    if ( $src->has_size() && $params->is_identity( $src->get_size() ) )
    175177    {
    176       // todo - what if we have a watermark maybe return a smaller size?
    177       $params = null;
    178       $rel_path = $rel_url = $src->rel_path;
    179       return;
     178      if (!$params->use_watermark && !$src->rotation)
     179      {
     180        $params = null;
     181        $rel_path = $rel_url = $src->rel_path;
     182        return;
     183      }
     184      $defined_types = array_keys(ImageStdParams::get_defined_type_map());
     185      for ($i=0; $i<count($defined_types); $i++)
     186      {
     187        if ($defined_types[$i] == $params->type)
     188        {
     189          for ($i--; $i>=0; $i--)
     190          {
     191            $smaller = ImageStdParams::get_by_type($defined_types[$i]);
     192            if ($smaller->sizing->max_crop==$params->sizing->max_crop && $smaller->is_identity( $src->get_size() ))
     193            {
     194              $params = $smaller;
     195              self::build($src, $params, $rel_path, $rel_url, $is_cached);
     196              return;
     197            }
     198          }
     199          break;
     200        }
     201      }
    180202    }
    181203
  • trunk/include/ws_functions.inc.php

    r13544 r14143  
    225225  }
    226226
    227   $query_model = 'SELECT id, path, representative_ext, width, height
     227  $query_model = 'SELECT id, path, representative_ext, width,height,rotation
    228228  FROM '.IMAGES_TABLE.'
    229229  WHERE '.implode(' AND ', $where_clauses).'
Note: See TracChangeset for help on using the changeset viewer.