Changeset 12820 for trunk/include
- Timestamp:
- Jan 1, 2012, 10:10:43 PM (12 years ago)
- Location:
- trunk/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/derivative_params.inc.php
r12797 r12820 279 279 280 280 /*how we generate a derivative image*/ 281 final class ImageParams281 final class DerivativeParams 282 282 { 283 283 public $type = IMG_CUSTOM; … … 290 290 } 291 291 292 public function __sleep() 293 { 294 return array('last_mod_time', 'sizing'); 295 } 296 292 297 function add_url_tokens(&$tokens) 293 298 { … … 298 303 { 299 304 $sizing = SizingParams::from_url_tokens($tokens); 300 $ret = new ImageParams($sizing);305 $ret = new DerivativeParams($sizing); 301 306 return $ret; 302 307 } -
trunk/include/derivative_std_params.inc.php
r12796 r12820 35 35 private static $type_map = array(); 36 36 private static $undefined_type_map = array(); 37 37 38 38 static function get_all_types() 39 39 { 40 40 return self::$all_types; 41 41 } 42 42 43 43 static function get_all_type_map() 44 44 { … … 55 55 return self::$undefined_type_map; 56 56 } 57 57 58 58 static function get_by_type($type) 59 59 { 60 60 return self::$all_type_map[$type]; 61 61 } 62 62 63 63 static function load_from_db() 64 64 { 65 self::make_default(); 65 global $conf; 66 $arr = @unserialize($conf['derivatives']); 67 if (false!==$arr) 68 { 69 self::$type_map = $arr['d']; 70 } 71 else 72 { 73 self::make_default(); 74 } 66 75 self::build_maps(); 67 76 } … … 69 78 static function load_from_file() 70 79 { 71 self::make_default(); 80 global $conf; 81 $arr = @unserialize(@file_get_contents(PHPWG_ROOT_PATH.$conf['data_location'].'derivatives.dat')); 82 if (false!==$arr) 83 { 84 self::$type_map = $arr['d']; 85 } 86 else 87 { 88 self::make_default(); 89 } 90 self::build_maps(); 91 } 92 93 static function set_and_save($map) 94 { 95 global $conf; 96 self::$type_map = $map; 97 98 $ser = serialize( array( 99 'd' => self::$type_map 100 ) ); 101 conf_update_param('derivatives', addslashes($ser) ); 102 file_put_contents(PHPWG_ROOT_PATH.$conf['data_location'].'derivatives.dat', $ser); 72 103 self::build_maps(); 73 104 } … … 75 106 static function make_default() 76 107 { 77 //todo 78 self::$type_map[IMG_SQUARE] = new ImageParams( SizingParams::square(100,100) ); 79 self::$type_map[IMG_THUMB] = new ImageParams( SizingParams::classic(144,144) ); 80 self::$type_map[IMG_SMALL] = new ImageParams( SizingParams::classic(240,240) ); 81 self::$type_map[IMG_MEDIUM] = new ImageParams( SizingParams::classic(432,432) ); 82 self::$type_map[IMG_LARGE] = new ImageParams( SizingParams::classic(648,576) ); 83 self::$type_map[IMG_XLARGE] = new ImageParams( SizingParams::classic(864,648) ); 84 self::$type_map[IMG_XXLARGE] = new ImageParams( SizingParams::classic(1200,900) ); 108 self::$type_map[IMG_SQUARE] = new DerivativeParams( SizingParams::square(100,100) ); 109 self::$type_map[IMG_THUMB] = new DerivativeParams( SizingParams::classic(144,144) ); 110 self::$type_map[IMG_SMALL] = new DerivativeParams( SizingParams::classic(240,240) ); 111 self::$type_map[IMG_MEDIUM] = new DerivativeParams( SizingParams::classic(432,432) ); 112 self::$type_map[IMG_LARGE] = new DerivativeParams( SizingParams::classic(648,576) ); 113 self::$type_map[IMG_XLARGE] = new DerivativeParams( SizingParams::classic(864,648) ); 114 self::$type_map[IMG_XXLARGE] = new DerivativeParams( SizingParams::classic(1200,900) ); 85 115 } 86 116 87 117 private static function build_maps() 88 118 { … … 111 141 } 112 142 } 113 143 114 144 } 115 145
Note: See TracChangeset
for help on using the changeset viewer.