-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
50 lines (32 loc) · 1.24 KB
/
README
File metadata and controls
50 lines (32 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
## dsHtml2ImagePlugin
A Symfony 1.x plugin that utilizes the wkhtmltoimage unix utility to
create snapshot images of web pages
## Dependencies
* sfImageTransformPlugin
* wkhtmltoimage
* xvfb-run
## wkhtmltoimage
The plugin comes complete with both the 32 and 64 bit binaries of
wkhtmltoimage-0.11.0_rc1 which are located in the plugins
lib/vendor/wkhtmltoimage folder
Further instructions can be found here;
http://madalgo.au.dk/~jakobt/wkhtmltoxdoc/wkhtmltoimage_0.10.0_rc2-doc.html
## Xvfb
wkhtmltoimage requires an X11 server in order to render the HTML to be
captured. I've chosen to use xvfb to do this. To install on ubuntu, simply
run the following;
$ sudo apt-get install xvfb
## Useage
$save_path = /absolute/path/to/image.jpg';
$url = 'http://www.url.to.capture.com/';
$h2i = new dsHtml2Image($url,$save_path);
$h2i->setOptions(array(
'quality' => 80,
'disable-javascript' => ''
));
$img = $h2i->getImage();
Will capture a full size screen capture of the url supplied, with the
quality set at 80% and the javascript disabled and save to the path
you specified.
The method getImage will return an instance of sfImage preloaded with the
screen capture for you to manipulate as required.