Changeset 12797 for trunk/include


Ignore:
Timestamp:
Dec 27, 2011, 9:26:49 PM (12 years ago)
Author:
rvelices
Message:

feature 2541 multisize

  • nicer presentation on picture.php
  • added a maintenance purge derivatives action
Location:
trunk/include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/derivative.inc.php

    r12796 r12797  
    2222final class SrcImage
    2323{
     24  const IS_ORIGINAL = 0x01;
     25  const IS_MIMETYPE = 0x02;
     26
    2427  public $rel_path;
    25  
     28
    2629  public $coi=null;
    2730  private $size=null;
     31  private $flags=0;
    2832
    2933  function __construct($infos)
     
    3539    {
    3640      $this->rel_path = $infos['path'];
     41      $this->flags |= self::IS_ORIGINAL;
    3742    }
    3843    elseif (!empty($infos['representative_ext']))
     
    4550    else
    4651    {
    47       $this->rel_path = get_themeconf('mime_icon_dir').strtolower($ext).'.png';
     52      $ext = strtolower($ext);
     53      $this->rel_path = trigger_event('get_mimetype_location', get_themeconf('mime_icon_dir').$ext.'.png', $ext );
     54      $this->flags |= self::IS_MIMETYPE;
     55      $this->size = @getimagesize(PHPWG_ROOT_PATH.$this->rel_path);
    4856    }
    4957
    5058    $this->coi = @$infos['coi'];
    51     if (isset($infos['width']) && isset($infos['height']))
     59    if (!$this->size && isset($infos['width']) && isset($infos['height']))
    5260    {
    5361      $this->size = array($infos['width'], $infos['height']);
    5462    }
     63  }
     64
     65  function is_original()
     66  {
     67    return $this->flags & self::IS_ORIGINAL;
     68  }
     69
     70  function is_mimetype()
     71  {
     72    return $this->flags & self::IS_MIMETYPE;
     73  }
     74
     75  function get_path()
     76  {
     77    return PHPWG_ROOT_PATH.$this->rel_path;
     78  }
     79
     80  function get_url()
     81  {
     82    return get_root_url().$this->rel_path;
    5583  }
    5684
     
    127155      $ret[$type] = $ret[$type2];
    128156    }
    129    
     157
    130158    return $ret;
    131159  }
     
    145173    $tokens[] = substr($params->type,0,2);
    146174
    147     if (!empty($src->coi))
     175    if ($params->sizing->max_crop != 0 and !empty($src->coi))
    148176    {
    149177      $tokens[] = 'ci'.$src->coi;
     
    207235
    208236
     237  function get_type()
     238  {
     239    if ($this->flags & self::SAME_AS_SRC)
     240      return 'original';
     241    return $this->params->type;
     242  }
     243
    209244  /* returns the size of the derivative image*/
    210245  function get_size()
  • trunk/include/derivative_params.inc.php

    r12796 r12797  
    2020// +-----------------------------------------------------------------------+
    2121
     22function derivative_to_url($t)
     23{
     24  return substr($t, 0, 2);
     25}
     26
    2227function size_to_url($s)
    2328{
  • trunk/include/picture_metadata.inc.php

    r12796 r12797  
    3737  }
    3838
    39   $exif = get_exif_data($picture['current']['image_path'], $exif_mapping);
     39  $exif = get_exif_data($picture['current']['src_image']->get_path(), $exif_mapping);
    4040 
    4141  if (count($exif) > 0)
     
    8080if ($conf['show_iptc'])
    8181{
    82   $iptc = get_iptc_data($picture['current']['image_path'], $conf['show_iptc_mapping']);
     82  $iptc = get_iptc_data($picture['current']['src_image']->get_path(), $conf['show_iptc_mapping']);
    8383
    8484  if (count($iptc) > 0)
Note: See TracChangeset for help on using the changeset viewer.