1 | <?php |
||
5 | class HtmlToImage implements HtmlToImageInterface |
||
6 | { |
||
7 | protected $url; |
||
8 | protected $path; |
||
9 | protected $shellExec; |
||
10 | protected $height; |
||
11 | protected $width; |
||
12 | protected $coordinateX; |
||
13 | protected $coordinateY; |
||
14 | protected $command = 'wkhtmltoimage'; |
||
15 | |||
16 | /** |
||
17 | * HtmlToImage constructor. |
||
18 | * @param null|ShellExec $shellExec |
||
19 | * @param string|null $command |
||
20 | */ |
||
21 | public function __construct(?ShellExec $shellExec = null, ?string $command = null) |
||
28 | |||
29 | /** |
||
30 | * set html url |
||
31 | * @param string $url |
||
32 | * @return HtmlToImageInterface |
||
33 | */ |
||
34 | public function url(string $url): HtmlToImageInterface |
||
40 | |||
41 | /** |
||
42 | * get html url |
||
43 | * @return string |
||
44 | */ |
||
45 | public function getUrl(): string |
||
49 | |||
50 | /** |
||
51 | * set html path |
||
52 | * @param string $path |
||
53 | * @return HtmlToImageInterface |
||
54 | */ |
||
55 | public function path(string $path): HtmlToImageInterface |
||
61 | |||
62 | /** |
||
63 | * get html path |
||
64 | * @return string |
||
65 | */ |
||
66 | public function getPath(): string |
||
70 | |||
71 | /** |
||
72 | * generate image |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | public function generate(): string |
||
80 | |||
81 | /** |
||
82 | * get bash command |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | public function getCommand() : string |
||
99 | |||
100 | /** |
||
101 | * @param int $value |
||
102 | * @return HtmlToImageInterface |
||
103 | */ |
||
104 | public function cropHeight(int $value) : HtmlToImageInterface |
||
110 | |||
111 | /** |
||
112 | * get height crop |
||
113 | * |
||
114 | * @return int|null |
||
115 | */ |
||
116 | public function getCropHeight(): ?int |
||
120 | |||
121 | /** |
||
122 | * set width for cropping |
||
123 | * |
||
124 | * @param int $value |
||
125 | * @return HtmlToImageInterface |
||
126 | */ |
||
127 | public function cropWidth(int $value): HtmlToImageInterface |
||
133 | |||
134 | /** |
||
135 | * get width crop |
||
136 | * |
||
137 | * @return int|null |
||
138 | */ |
||
139 | public function getCropWidth(): ?int |
||
143 | |||
144 | /** |
||
145 | * set X coordinate |
||
146 | * |
||
147 | * @param int $value |
||
148 | * @return HtmlToImageInterface |
||
149 | */ |
||
150 | public function coordinateX(int $value): HtmlToImageInterface |
||
156 | |||
157 | /** |
||
158 | * get X coordinate |
||
159 | * |
||
160 | * @return int|null |
||
161 | */ |
||
162 | public function getCoordinateX(): ?int |
||
166 | |||
167 | /** |
||
168 | * set Y coordinate |
||
169 | * |
||
170 | * @param int $value |
||
171 | * @return HtmlToImageInterface |
||
172 | */ |
||
173 | public function coordinateY(int $value): HtmlToImageInterface |
||
179 | |||
180 | /** |
||
181 | * get Y coordinate |
||
182 | * |
||
183 | * @return int|null |
||
184 | */ |
||
185 | public function getCoordinateY(): ?int |
||
189 | } |
||
190 |