1 | <?php |
||
17 | class Thumbnail |
||
18 | { |
||
19 | protected $metadata = []; |
||
20 | protected $srcImage; |
||
21 | protected $dstImage; |
||
22 | |||
23 | /** |
||
24 | * Create a thumbnail from a local file. |
||
25 | * |
||
26 | * @static |
||
27 | * |
||
28 | * @param string $filename |
||
29 | * |
||
30 | * @return Thumbnail |
||
31 | */ |
||
32 | public static function createFromFile($filename) |
||
39 | |||
40 | /** |
||
41 | * Create a thumbnail from a string. |
||
42 | * |
||
43 | * @static |
||
44 | * |
||
45 | * @param string $blob |
||
46 | * |
||
47 | * @return Thumbnail |
||
48 | */ |
||
49 | public static function createFromString($blob) |
||
56 | |||
57 | /** |
||
58 | * Load the local image file in memory with GD. |
||
59 | * |
||
60 | * @param string $filename |
||
61 | * |
||
62 | * @return Thumbnail |
||
63 | */ |
||
64 | public function fromFile($filename) |
||
71 | |||
72 | /** |
||
73 | * Load the image blob in memory with GD. |
||
74 | * |
||
75 | * @param string $blob |
||
76 | * |
||
77 | * @return Thumbnail |
||
78 | */ |
||
79 | public function fromString($blob) |
||
92 | |||
93 | /** |
||
94 | * Resize the image. |
||
95 | * |
||
96 | * @param int $width |
||
97 | * @param int $height |
||
98 | * |
||
99 | * @return Thumbnail |
||
100 | */ |
||
101 | public function resize($width = 250, $height = 100) |
||
142 | |||
143 | /** |
||
144 | * Save the thumbnail to a local file. |
||
145 | * |
||
146 | * @param string $filename |
||
147 | * |
||
148 | * @return Thumbnail |
||
149 | */ |
||
150 | public function toFile($filename) |
||
158 | |||
159 | /** |
||
160 | * Return the thumbnail as a string. |
||
161 | * |
||
162 | * @return string |
||
163 | */ |
||
164 | public function toString() |
||
173 | |||
174 | /** |
||
175 | * Output the thumbnail directly to the browser or stdout. |
||
176 | */ |
||
177 | public function toOutput() |
||
183 | } |
||
184 |