Changeset 12797 for trunk/include/derivative.inc.php
- Timestamp:
- Dec 27, 2011, 9:26:49 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/derivative.inc.php
r12796 r12797 22 22 final class SrcImage 23 23 { 24 const IS_ORIGINAL = 0x01; 25 const IS_MIMETYPE = 0x02; 26 24 27 public $rel_path; 25 28 26 29 public $coi=null; 27 30 private $size=null; 31 private $flags=0; 28 32 29 33 function __construct($infos) … … 35 39 { 36 40 $this->rel_path = $infos['path']; 41 $this->flags |= self::IS_ORIGINAL; 37 42 } 38 43 elseif (!empty($infos['representative_ext'])) … … 45 50 else 46 51 { 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); 48 56 } 49 57 50 58 $this->coi = @$infos['coi']; 51 if ( isset($infos['width']) && isset($infos['height']))59 if (!$this->size && isset($infos['width']) && isset($infos['height'])) 52 60 { 53 61 $this->size = array($infos['width'], $infos['height']); 54 62 } 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; 55 83 } 56 84 … … 127 155 $ret[$type] = $ret[$type2]; 128 156 } 129 157 130 158 return $ret; 131 159 } … … 145 173 $tokens[] = substr($params->type,0,2); 146 174 147 if ( !empty($src->coi))175 if ($params->sizing->max_crop != 0 and !empty($src->coi)) 148 176 { 149 177 $tokens[] = 'ci'.$src->coi; … … 207 235 208 236 237 function get_type() 238 { 239 if ($this->flags & self::SAME_AS_SRC) 240 return 'original'; 241 return $this->params->type; 242 } 243 209 244 /* returns the size of the derivative image*/ 210 245 function get_size()
Note: See TracChangeset
for help on using the changeset viewer.