Skip to content

danofsteele/dsHtml2ImagePlugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

## 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published