1 | <?php |
||
22 | class Watermark extends BaseManipulator |
||
23 | { |
||
24 | /** |
||
25 | * The watermarks file system. |
||
26 | * @var FilesystemInterface|null |
||
27 | */ |
||
28 | protected $watermarks; |
||
29 | |||
30 | /** |
||
31 | * The watermarks path prefix. |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $watermarksPathPrefix; |
||
35 | |||
36 | /** |
||
37 | * Create Watermark instance. |
||
38 | * @param FilesystemInterface $watermarks The watermarks file system. |
||
39 | 57 | */ |
|
40 | public function __construct(FilesystemInterface $watermarks = null, $watermarksPathPrefix = '') |
||
45 | |||
46 | /** |
||
47 | * Set the watermarks file system. |
||
48 | * @param FilesystemInterface $watermarks The watermarks file system. |
||
49 | 57 | */ |
|
50 | public function setWatermarks(FilesystemInterface $watermarks = null) |
||
54 | |||
55 | /** |
||
56 | * Get the watermarks file system. |
||
57 | * @return FilesystemInterface The watermarks file system. |
||
58 | 12 | */ |
|
59 | public function getWatermarks() |
||
63 | |||
64 | /** |
||
65 | * Set the watermarks path prefix. |
||
66 | * @param string $watermarksPathPrefix The watermarks path prefix. |
||
67 | 57 | */ |
|
68 | public function setWatermarksPathPrefix($watermarksPathPrefix = '') |
||
72 | |||
73 | /** |
||
74 | * Get the watermarks path prefix. |
||
75 | * @return string The watermarks path prefix. |
||
76 | 6 | */ |
|
77 | public function getWatermarksPathPrefix() |
||
81 | |||
82 | /** |
||
83 | * Perform watermark image manipulation. |
||
84 | * @param Image $image The source image. |
||
85 | * @return Image The manipulated image. |
||
86 | 3 | */ |
|
87 | public function run(Image $image) |
||
120 | 18 | ||
121 | /** |
||
122 | 18 | * Get the watermark image. |
|
123 | 3 | * @param Image $image The source image. |
|
124 | * @return Image|null The watermark image. |
||
125 | */ |
||
126 | 15 | public function getImage(Image $image) |
|
158 | |||
159 | 6 | /** |
|
160 | * Get a dimension. |
||
161 | 6 | * @param Image $image The source image. |
|
162 | 6 | * @param string $field The requested field. |
|
163 | * @return double|null The dimension. |
||
164 | 6 | */ |
|
165 | public function getDimension(Image $image, $field) |
||
171 | |||
172 | 9 | /** |
|
173 | 9 | * Resolve the device pixel ratio. |
|
174 | * @return double The device pixel ratio. |
||
175 | */ |
||
176 | 3 | public function getDpr() |
|
188 | |||
189 | /** |
||
190 | 6 | * Get the fit. |
|
191 | 4 | * @return string The fit. |
|
192 | 4 | */ |
|
193 | 4 | public function getFit() |
|
215 | |||
216 | /** |
||
217 | 6 | * Get the position. |
|
218 | 4 | * @return string The position. |
|
219 | 4 | */ |
|
220 | 4 | public function getPosition() |
|
240 | |||
241 | /** |
||
242 | * Get the alpha channel. |
||
243 | * @return int The alpha. |
||
244 | */ |
||
245 | public function getAlpha() |
||
257 | } |
||
258 |