Changeset 13021 for trunk/include/derivative_std_params.inc.php
- Timestamp:
- Feb 2, 2012, 9:59:41 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/derivative_std_params.inc.php
r12851 r13021 47 47 private static $undefined_type_map = array(); 48 48 private static $watermark; 49 public static $custom = array(); 49 50 50 51 static function get_all_types() … … 71 72 { 72 73 return self::$all_type_map[$type]; 74 } 75 76 static function get_custom($w, $h, $crop=0, $minw=null, $minh=null) 77 { 78 $params = new DerivativeParams( new SizingParams( array($w,$h), $crop, array($minw,$minh)) ); 79 self::apply_global($params); 80 81 $key = array(); 82 $params->add_url_tokens($key); 83 $key = implode('_',$key); 84 if ( @self::$custom[$key] < time() - 24*3600) 85 { 86 self::$custom[$key] = time(); 87 self::save(); 88 } 89 return $params; 73 90 } 74 91 … … 104 121 self::$watermark = @$arr['w']; 105 122 if (!self::$watermark) self::$watermark = new WatermarkParams(); 123 self::$custom = @$arr['c']; 124 if (!self::$custom) self::$custom = array(); 106 125 } 107 126 else … … 119 138 static function set_and_save($map) 120 139 { 140 self::$type_map = $map; 141 self::save(); 142 self::build_maps(); 143 } 144 145 static function save() 146 { 121 147 global $conf; 122 self::$type_map = $map;123 148 124 149 $ser = serialize( array( 125 150 'd' => self::$type_map, 126 151 'w' => self::$watermark, 152 'c' => self::$custom, 127 153 ) ); 128 154 conf_update_param('derivatives', addslashes($ser) ); 129 155 file_put_contents(PHPWG_ROOT_PATH.$conf['data_location'].'derivatives.dat', $ser); 130 self::build_maps();131 156 } 132 157 … … 143 168 } 144 169 145 publicstatic function apply_global($params)170 static function apply_global($params) 146 171 { 147 172 if (!empty(self::$watermark->file) &&
Note: See TracChangeset
for help on using the changeset viewer.