1 | <?php declare(strict_types=1); |
||
7 | class Imagick extends AbstractImage implements ImageInterface |
||
8 | { |
||
9 | |||
10 | /** |
||
11 | * @var \Imagick |
||
12 | */ |
||
13 | private $image; |
||
14 | |||
15 | /** |
||
16 | * Imagick constructor. |
||
17 | * @param string $image |
||
18 | * @throws \Exception |
||
19 | */ |
||
20 | public function __construct(string $image) |
||
24 | |||
25 | /** |
||
26 | * @param int $width |
||
27 | * @param int $height |
||
28 | * @return ImageInterface |
||
29 | * @throws \ImagickException |
||
30 | */ |
||
31 | public function resize(int $width, int $height): ImageInterface |
||
38 | |||
39 | /** |
||
40 | * @return \Imagick |
||
41 | */ |
||
42 | public function getImage(): \Imagick |
||
46 | |||
47 | public function setImage($image): void |
||
51 | |||
52 | protected function setSizes(): void |
||
58 | |||
59 | /** |
||
60 | * @param int $angle |
||
61 | * @return ImageInterface |
||
62 | */ |
||
63 | public function rotate(int $angle = 90): ImageInterface |
||
70 | |||
71 | /** |
||
72 | * @return ImageInterface |
||
73 | */ |
||
74 | public function flip(): ImageInterface |
||
80 | |||
81 | /** |
||
82 | * @return ImageInterface |
||
83 | */ |
||
84 | public function flop(): ImageInterface |
||
90 | |||
91 | public function grayscale(): ImageInterface |
||
97 | |||
98 | /** |
||
99 | * @param string $text |
||
100 | * @param string $position |
||
101 | * @param string $font |
||
102 | * @return $this |
||
103 | * @throws \Exception |
||
104 | */ |
||
105 | public function copyright(string $text, string $font = 'Courier', string $position = 'SouthWest'): ImageInterface |
||
126 | |||
127 | public function getFontsList(): array |
||
131 | |||
132 | /** |
||
133 | * @param string $text |
||
134 | * @param int $position |
||
135 | * @param string $font |
||
136 | * @return \Imagick |
||
137 | * @throws \ImagickException |
||
138 | */ |
||
139 | private function prepareImage(string $text, int $position, string $font): \Imagick |
||
161 | |||
162 | /** |
||
163 | * @param int $width |
||
164 | * @param int $height |
||
165 | * @param int $startX |
||
166 | * @param int $startY |
||
167 | * @return ImageInterface |
||
168 | */ |
||
169 | public function crop(int $width, int $height, int $startX, int $startY): ImageInterface |
||
176 | |||
177 | public function save(string $filename): bool |
||
181 | |||
182 | public function __toString(): string |
||
186 | |||
187 | /** |
||
188 | * @param string $source |
||
189 | * @return ImageInterface |
||
190 | * @throws \Exception |
||
191 | */ |
||
192 | protected function tmp(string $source): ImageInterface |
||
208 | |||
209 | /** |
||
210 | * @param int $width |
||
211 | * @param int $height |
||
212 | * @return \Imagick |
||
213 | * @throws \ImagickException |
||
214 | */ |
||
215 | private function newImage(int $width, int $height): \Imagick |
||
223 | |||
224 | /** |
||
225 | * @param Image $watermark |
||
226 | * @param int $x |
||
227 | * @param int $y |
||
228 | * @return ImageInterface |
||
229 | * @throws \Exception |
||
230 | */ |
||
231 | protected function prepareWatermark(Image $watermark, int $x, int $y): ImageInterface |
||
238 | } |
||
239 |