1 | <?php |
||
17 | abstract class Basic |
||
18 | { |
||
19 | const LOW = 'low'; |
||
20 | const MEDIUM = 'medium'; |
||
21 | const QUARTILE = 'quartile'; |
||
22 | const HIGH = 'high'; |
||
23 | |||
24 | /** |
||
25 | * Image GD |
||
26 | * |
||
27 | * @var resource |
||
28 | */ |
||
29 | public $img; |
||
30 | /** |
||
31 | * Image Height |
||
32 | * |
||
33 | * @var int |
||
34 | */ |
||
35 | protected $imgHeight = 0; |
||
36 | /** |
||
37 | * Image Width |
||
38 | * |
||
39 | * @var int |
||
40 | */ |
||
41 | 2 | protected $imgWidth = 0; |
|
42 | |||
43 | 2 | /** |
|
44 | * @return int height of the image in pixels |
||
45 | */ |
||
46 | public function getHeight() |
||
50 | |||
51 | 1 | /** |
|
52 | * @return int Number of bytes to represent a row of this image |
||
53 | */ |
||
54 | public function getHeightBytes() |
||
58 | |||
59 | 1 | /** |
|
60 | * @return int Width of the image |
||
61 | */ |
||
62 | public function getWidth() |
||
66 | |||
67 | 1 | /** |
|
68 | * @return int Number of bytes to represent a row of this image |
||
69 | */ |
||
70 | public function getWidthBytes() |
||
74 | |||
75 | /** |
||
76 | * getDimImage |
||
77 | 9 | * Get width and height of resource image |
|
78 | * and save in properties |
||
79 | 9 | * |
|
80 | 8 | * @return array with dimentions of image |
|
81 | 8 | */ |
|
82 | 8 | public function getDimImage() |
|
90 | |||
91 | 12 | /** |
|
92 | * @return boolean True if GD is supported, false otherwise (a wrapper for the version, for mocking in tests) |
||
93 | */ |
||
94 | protected function isGdSupported() |
||
98 | |||
99 | 12 | /** |
|
100 | 12 | * @return boolean True if GD is loaded, false otherwise |
|
101 | */ |
||
102 | protected function isGdLoaded() |
||
107 | |||
108 | /** |
||
109 | * identifyImg |
||
110 | 8 | * Identifies image file type |
|
111 | * |
||
112 | 8 | * @param string $filename |
|
113 | * @return string |
||
114 | 8 | */ |
|
115 | 8 | protected function identifyImg($filename) |
|
139 | } |
||
140 |