1 | <?php |
---|
2 | |
---|
3 | define('IMG_TINY', 'tiny'); |
---|
4 | define('IMG_THUMB', 'thumb'); |
---|
5 | define('IMG_SMALL', 'small'); |
---|
6 | define('IMG_MEDIUM', 'medium'); |
---|
7 | define('IMG_LARGE', 'large'); |
---|
8 | define('IMG_XLARGE', 'xlarge'); |
---|
9 | define('IMG_XXLARGE', 'xxlarge'); |
---|
10 | define('IMG_CUSTOM', 'custom'); |
---|
11 | |
---|
12 | final class ImageStdParams |
---|
13 | { |
---|
14 | private static $all_types = array(); |
---|
15 | private static $type_map = array(); |
---|
16 | |
---|
17 | static function get_all_types() |
---|
18 | { |
---|
19 | return self::$all_types; |
---|
20 | } |
---|
21 | |
---|
22 | static function get_by_type($type) |
---|
23 | { |
---|
24 | return self::$type_map[$type]; |
---|
25 | } |
---|
26 | |
---|
27 | static function load_from_db() |
---|
28 | { |
---|
29 | self::make_default(); |
---|
30 | } |
---|
31 | |
---|
32 | static function load_from_file() |
---|
33 | { |
---|
34 | self::make_default(); |
---|
35 | } |
---|
36 | |
---|
37 | static function make_default() |
---|
38 | { |
---|
39 | //todo |
---|
40 | self::$type_map[IMG_TINY] = new ImageParams( SizingParams::square(100,100) ); |
---|
41 | self::$type_map[IMG_THUMB] = new ImageParams( SizingParams::classic(144,144) ); |
---|
42 | self::$type_map[IMG_SMALL] = new ImageParams( SizingParams::classic(240,240) ); |
---|
43 | self::$type_map[IMG_MEDIUM] = new ImageParams( SizingParams::classic(432,432) ); |
---|
44 | self::$type_map[IMG_LARGE] = new ImageParams( SizingParams::classic(864,648) ); |
---|
45 | self::$all_types = array_keys(self::$type_map); |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | ?> |
---|