1 | <?php declare(strict_types=1); |
||
7 | class GD extends AbstractImage implements ImageInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var resource |
||
11 | */ |
||
12 | private $image; |
||
13 | |||
14 | /** |
||
15 | * GD constructor. |
||
16 | * @param string $image |
||
17 | * @throws \Exception |
||
18 | */ |
||
19 | 9 | public function __construct(string $image) |
|
23 | |||
24 | public function flip(): ImageInterface |
||
30 | |||
31 | /** |
||
32 | * @return resource |
||
33 | */ |
||
34 | 9 | public function getImage() |
|
38 | |||
39 | 8 | public function setImage($image): void |
|
43 | |||
44 | public function flop(): ImageInterface |
||
50 | |||
51 | public function grayscale(): ImageInterface |
||
57 | |||
58 | /** |
||
59 | * @param string $text |
||
60 | * @param string $font |
||
61 | * @param string $position |
||
62 | * @return $this |
||
63 | * @throws \InvalidArgumentException |
||
64 | * @throws \Exception |
||
65 | */ |
||
66 | 1 | public function copyright(string $text, string $font, string $position = 'SouthWest'): ImageInterface |
|
86 | |||
87 | /** |
||
88 | * @param string $text |
||
89 | * @param string $font |
||
90 | * @return resource |
||
91 | * @throws \InvalidArgumentException |
||
92 | * @throws \Exception |
||
93 | */ |
||
94 | private function prepareImage(string $text, string $font) |
||
121 | |||
122 | /** |
||
123 | * @param int $width |
||
124 | * @param int $height |
||
125 | * @return resource |
||
126 | */ |
||
127 | 3 | private function newImage(int $width, int $height) |
|
137 | |||
138 | /** |
||
139 | * @param int $width |
||
140 | * @param int $height |
||
141 | * @return ImageInterface |
||
142 | */ |
||
143 | 2 | public function resize(int $width, int $height): ImageInterface |
|
153 | |||
154 | 8 | protected function setSizes(): void |
|
159 | |||
160 | /** |
||
161 | * @param int $width |
||
162 | * @param int $height |
||
163 | * @param int $x |
||
164 | * @param int $y |
||
165 | * @return ImageInterface |
||
166 | */ |
||
167 | public function crop(int $width, int $height, int $x, int $y): ImageInterface |
||
178 | |||
179 | /** |
||
180 | * @param int $angle |
||
181 | * @return ImageInterface |
||
182 | */ |
||
183 | 1 | public function rotate(int $angle = 90): ImageInterface |
|
195 | |||
196 | /** |
||
197 | * @throws \LogicException |
||
198 | * @throws \RangeException |
||
199 | * @return string |
||
200 | */ |
||
201 | 1 | public function __toString(): string |
|
214 | |||
215 | /** |
||
216 | * @param string $filename |
||
217 | * @param int $quality |
||
218 | * @return bool |
||
219 | */ |
||
220 | 1 | public function save(string $filename, $quality = 100): bool |
|
224 | |||
225 | /** |
||
226 | * @param int $width |
||
227 | * @param int $height |
||
228 | * @param int $newWidth |
||
229 | * @param int $newHeight |
||
230 | * @return ImageInterface |
||
231 | */ |
||
232 | 1 | protected function prepareThumbnail( |
|
255 | |||
256 | /** |
||
257 | * @param string $source |
||
258 | * @return ImageInterface |
||
259 | * @throws \InvalidArgumentException |
||
260 | * @throws \Exception |
||
261 | */ |
||
262 | 8 | protected function tmp(string $source): ImageInterface |
|
275 | |||
276 | /** |
||
277 | * @param Image $watermark |
||
278 | * @param int $x |
||
279 | * @param int $y |
||
280 | * @return ImageInterface |
||
281 | */ |
||
282 | protected function prepareWatermark(Image $watermark, int $x, int $y): ImageInterface |
||
301 | } |
||
302 |