Changeset 25754 for trunk/include/derivative_std_params.inc.php
- Timestamp:
- Nov 29, 2013, 2:48:55 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/derivative_std_params.inc.php
r19703 r25754 20 20 // +-----------------------------------------------------------------------+ 21 21 22 /** 23 * @package Derivatives 24 */ 25 26 22 27 define('IMG_SQUARE', 'square'); 23 28 define('IMG_THUMB', 'thumb'); … … 31 36 define('IMG_CUSTOM', 'custom'); 32 37 38 39 /** 40 * Container for watermark configuration. 41 */ 33 42 final class WatermarkParams 34 43 { 44 /** @var string */ 35 45 public $file = ''; 46 /** @var int[] */ 36 47 public $min_size = array(500,500); 48 /** @var int */ 37 49 public $xpos = 50; 50 /** @var int */ 38 51 public $ypos = 50; 52 /** @var int */ 39 53 public $xrepeat = 0; 54 /** @var int */ 40 55 public $opacity = 100; 41 56 } 42 57 43 58 59 /** 60 * Container for standard derivatives parameters. 61 */ 44 62 final class ImageStdParams 45 63 { 64 /** @var string[] */ 46 65 private static $all_types = array( 47 IMG_SQUARE,IMG_THUMB,IMG_XXSMALL,IMG_XSMALL,IMG_SMALL,IMG_MEDIUM,IMG_LARGE,IMG_XLARGE,IMG_XXLARGE 66 IMG_SQUARE, IMG_THUMB, IMG_XXSMALL, IMG_XSMALL, IMG_SMALL, 67 IMG_MEDIUM, IMG_LARGE, IMG_XLARGE, IMG_XXLARGE 48 68 ); 69 /** @var DerivativeParams[] */ 49 70 private static $all_type_map = array(); 71 /** @var DerivativeParams[] */ 50 72 private static $type_map = array(); 73 /** @var DerivativeParams[] */ 51 74 private static $undefined_type_map = array(); 75 /** @var WatermarkParams */ 52 76 private static $watermark; 77 /** @var array */ 53 78 public static $custom = array(); 79 /** @var int */ 54 80 public static $quality=95; 55 81 82 /** 83 * @return string[] 84 */ 56 85 static function get_all_types() 57 86 { … … 59 88 } 60 89 90 /** 91 * @return DerivativeParams[] 92 */ 61 93 static function get_all_type_map() 62 94 { … … 64 96 } 65 97 98 /** 99 * @return DerivativeParams[] 100 */ 66 101 static function get_defined_type_map() 67 102 { … … 69 104 } 70 105 106 /** 107 * @return DerivativeParams[] 108 */ 71 109 static function get_undefined_type_map() 72 110 { … … 74 112 } 75 113 114 /** 115 * @return DerivativeParams 116 */ 76 117 static function get_by_type($type) 77 118 { … … 79 120 } 80 121 122 /** 123 * @param int $w 124 * @param int $h 125 * @param float $crop 126 * @param int $minw 127 * @param int $minh 128 * @return DerivativeParams 129 */ 81 130 static function get_custom($w, $h, $crop=0, $minw=null, $minh=null) 82 131 { … … 95 144 } 96 145 146 /** 147 * @return WatermarkParams 148 */ 97 149 static function get_watermark() 98 150 { … … 100 152 } 101 153 154 /** 155 * Loads derivative configuration from database or initializes it. 156 */ 102 157 static function load_from_db() 103 158 { … … 122 177 } 123 178 179 /** 180 * @param WatermarkParams $watermark 181 */ 124 182 static function set_watermark($watermark) 125 183 { … … 127 185 } 128 186 187 /** 188 * @see ImageStdParams::save() 189 * 190 * @param DerivativeParams[] $map 191 */ 129 192 static function set_and_save($map) 130 193 { … … 134 197 } 135 198 199 /** 200 * Saves the configuration in database. 201 */ 136 202 static function save() 137 203 { … … 147 213 } 148 214 215 /** 216 * @return DerivativeParams[] 217 */ 149 218 static function get_default_sizes() 150 219 { … … 160 229 IMG_XXLARGE => new DerivativeParams( SizingParams::classic(1656,1242) ), 161 230 ); 231 $now = time(); 162 232 foreach($arr as $params) 163 233 { 164 $params->last_mod_time = time();234 $params->last_mod_time = $now; 165 235 } 166 236 return $arr; 167 237 } 168 238 239 /** 240 * Compute 'apply_watermark' 241 * 242 * @param DerivativeParams $params 243 */ 169 244 static function apply_global($params) 170 245 { … … 174 249 } 175 250 251 /** 252 * Build 'type_map', 'all_type_map' and 'undefined_type_map'. 253 */ 176 254 private static function build_maps() 177 255 { … … 201 279 } 202 280 } 203 204 281 } 205 282
Note: See TracChangeset
for help on using the changeset viewer.