Changeset 19878
- Timestamp:
- Jan 6, 2013, 7:59:27 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/derivative.inc.php
r19703 r19878 20 20 // +-----------------------------------------------------------------------+ 21 21 22 /*A source image is used to get a derivative image. A source image is either the original file for a jpg or a 23 'representative' image of a non image file or a standard icon for the non-image file.*/ 22 24 final class SrcImage 23 25 { … … 33 35 private $flags=0; 34 36 37 /*@param infos assoc array of data from images table*/ 35 38 function __construct($infos) 36 39 { … … 116 119 } 117 120 121 /* @return a 2-element array containing width/height or null if dimensions are not available*/ 118 122 function get_size() 119 123 { … … 134 138 135 139 136 140 /*Holds information (path, url, dimensions) about a derivative image. A derivative image is constructed from a source 141 image (SrcImage class) and derivative parameters (DerivativeParams class). 142 */ 137 143 final class DerivativeImage 138 144 { … … 142 148 private $rel_path, $rel_url, $is_cached=true; 143 149 144 function __construct($type, $src_image) 150 /* 151 @param type string of standard derivative param type (e.g. IMG_???) or a DerivativeParams object 152 @param src_image the source image of this derivative*/ 153 function __construct($type, SrcImage $src_image) 145 154 { 146 155 $this->src_image = $src_image; … … 162 171 } 163 172 173 /** 174 @return derivative image url 175 @param type string of standard derivative param type (e.g. IMG_???) or a DerivativeParams object 176 @param infos assoc array of data from images table or a SrcImage object 177 */ 164 178 static function url($type, $infos) 165 179 { … … 178 192 } 179 193 194 /** 195 @return an associative array of derivative images with keys all standard derivative image types: 196 Disabled derivative types can be still found in the return mapped to an enabled derivative (e.g. the values are not 197 unique in the return array). This is useful for any plugin/theme to just use $deriv[IMG_XLARGE] even if the XLARGE is 198 disabled. 199 */ 180 200 static function get_all($src_image) 181 201 { 182 202 $ret = array(); 203 // build enabled types 183 204 foreach (ImageStdParams::get_defined_type_map() as $type => $params) 184 205 { … … 186 207 $ret[$type] = $derivative; 187 208 } 209 // disabled types fqllbqck to enqbled types 188 210 foreach (ImageStdParams::get_undefined_type_map() as $type => $type2) 189 211 { … … 197 219 { 198 220 if ( $src->has_size() && $params->is_identity( $src->get_size() ) ) 199 { 221 {// the source image is smaller than what we should do - we do not upsample 200 222 if (!$params->will_watermark($src->get_size()) && !$src->rotation) 201 { 223 {// no watermark, no rotation required -> we will use the source image 202 224 $params = null; 203 225 $rel_path = $rel_url = $src->rel_path;
Note: See TracChangeset
for help on using the changeset viewer.