1 | <?php declare(strict_types=1); |
||
13 | class Imagick2 extends AbstractImage |
||
14 | { |
||
15 | /** |
||
16 | * Imagick constructor. |
||
17 | * @param string $image |
||
18 | * @throws Exception |
||
19 | */ |
||
20 | 9 | public function __construct(string $image) |
|
24 | |||
25 | /** |
||
26 | * @param int $width |
||
27 | * @param int $height |
||
28 | * @return ImageInterface |
||
29 | * @throws ImagickException |
||
30 | */ |
||
31 | 1 | public function resize(int $width, int $height): ImageInterface |
|
38 | |||
39 | 9 | protected function setSizes(): void |
|
46 | |||
47 | /** |
||
48 | * @param int $angle |
||
49 | * @return ImageInterface |
||
50 | */ |
||
51 | 1 | public function rotate(int $angle = 90): ImageInterface |
|
58 | |||
59 | /** |
||
60 | * @return ImageInterface |
||
61 | */ |
||
62 | public function flip(): ImageInterface |
||
68 | |||
69 | /** |
||
70 | * @return ImageInterface |
||
71 | */ |
||
72 | public function flop(): ImageInterface |
||
78 | |||
79 | public function grayscale(): ImageInterface |
||
86 | |||
87 | /** |
||
88 | * @param string $text |
||
89 | * @param string $position |
||
90 | * @param string $font |
||
91 | * @return ImageInterface |
||
92 | * @throws InvalidArgumentException |
||
93 | * @throws ImagickException |
||
94 | */ |
||
95 | 1 | public function copyright(string $text, string $font = 'Courier', string $position = 'SouthWest'): ImageInterface |
|
116 | |||
117 | 1 | public function getFontsList(): array |
|
121 | |||
122 | /** |
||
123 | * @param string $text |
||
124 | * @param int $position |
||
125 | * @param string $font |
||
126 | * @return Imagick |
||
127 | * @throws ImagickException |
||
128 | */ |
||
129 | private function prepareImage(string $text, int $position, string $font): Imagick |
||
151 | |||
152 | /** |
||
153 | * @param int $width |
||
154 | * @param int $height |
||
155 | * @param int $startX |
||
156 | * @param int $startY |
||
157 | * @return ImageInterface |
||
158 | */ |
||
159 | public function crop(int $width, int $height, int $startX, int $startY): ImageInterface |
||
166 | |||
167 | 1 | public function save(string $filename, $quality = 100): bool |
|
174 | |||
175 | 1 | public function __toString(): string |
|
179 | |||
180 | /** |
||
181 | * @param int $width |
||
182 | * @param int $height |
||
183 | * @return ImageInterface |
||
184 | * @throws ImagickException |
||
185 | */ |
||
186 | 1 | protected function prepareThumbnail(int $width, int $height): ImageInterface |
|
192 | |||
193 | /** |
||
194 | * @param string $source |
||
195 | * @return ImageInterface |
||
196 | * @throws ImagickException |
||
197 | */ |
||
198 | 9 | protected function tmp(string $source): ImageInterface |
|
214 | |||
215 | /** |
||
216 | * @param int $width |
||
217 | * @param int $height |
||
218 | * @return Imagick |
||
219 | * @throws ImagickException |
||
220 | */ |
||
221 | 9 | protected function newImage(int $width, int $height): Imagick |
|
229 | |||
230 | /** |
||
231 | * @param Image $watermark |
||
232 | * @param int $x |
||
233 | * @param int $y |
||
234 | * @return ImageInterface |
||
235 | * @throws Exception |
||
236 | */ |
||
237 | protected function prepareWatermark($watermark, int $x, int $y): ImageInterface |
||
244 | |||
245 | public function resizeByTransparentBackground(int $width, int $height): ImageInterface |
||
250 | |||
251 | public function resizeByBlurBackground(int $width, int $height): ImageInterface |
||
256 | } |
||
257 |