File tree Expand file tree Collapse file tree 1 file changed +42
-2
lines changed Expand file tree Collapse file tree 1 file changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,18 @@ class Capture
28
28
*/
29
29
protected $ url ;
30
30
31
+ /**
32
+ * dom element top position
33
+ * @var string
34
+ */
35
+ protected $ top ;
36
+
37
+ /**
38
+ * dom element left position
39
+ * @var string
40
+ */
41
+ protected $ left ;
42
+
31
43
/**
32
44
* Width of the page to render
33
45
*
@@ -191,8 +203,8 @@ public function save($imageLocation, $deleteFileIfExists = true)
191
203
if ($ this ->clipWidth && $ this ->clipHeight ) {
192
204
$ data ['clipOptions ' ]['width ' ] = $ this ->clipWidth ;
193
205
$ data ['clipOptions ' ]['height ' ] = $ this ->clipHeight ;
194
- $ data ['clipOptions ' ]['top ' ] = 0 ;
195
- $ data ['clipOptions ' ]['left ' ] = 0 ;
206
+ $ data ['clipOptions ' ]['top ' ] = $ this -> top ;
207
+ $ data ['clipOptions ' ]['left ' ] = $ this -> left ;
196
208
}
197
209
198
210
if ($ this ->backgroundColor ) {
@@ -316,6 +328,34 @@ public function setUrl($url)
316
328
$ this ->url = new Url ($ url );
317
329
}
318
330
331
+ /**
332
+ * Sets the dom top position
333
+ *
334
+ * @param int $top dom top position
335
+ *
336
+ * @return Capture
337
+ */
338
+ public function setTop ($ top )
339
+ {
340
+ $ this ->top = $ top ;
341
+
342
+ return $ this ;
343
+ }
344
+
345
+ /**
346
+ * Sets the page width
347
+ *
348
+ * @param int $left dom left position
349
+ *
350
+ * @return Capture
351
+ */
352
+ public function setLeft ($ left )
353
+ {
354
+ $ this ->left = $ left ;
355
+
356
+ return $ this ;
357
+ }
358
+
319
359
/**
320
360
* Sets the page width
321
361
*
You can’t perform that action at this time.
0 commit comments