Skip to content

kjunggithub/webkit2png-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webkit2png-php

webkit2png-php is a PHP wrapper for the webkit2png binary available on Mac OS X. Latest webkit2png version tested with this library is v0.6. For more details on webkit2png, please refer to the webkit2png project page.

Requirements

Installation

To get started, require the library in your composer.json file:

{
	"require": {
		"kjung/webkit2png-php": "1.0.*@dev"
	}
}

Then run composer install or composer update.

Usage

  • Start by loading the autoloader:
require_once 'vendor/autoload.php';
  • Instantiate the library with the URL:
$webkit2png = new \kjung\webkit2png('http://google.com');
  • You can pass options to it but it is not required:
$webkit2png->setOptions(array(
	'dir'      => 'screenshots/',
	'width'    => 1000,
	'fullsize' => true
	)
);

The library default directory is set to images/ but you can always override it with the dir option as seen above.

  • Now Generate the image:
$webkit2png->getImage();

And thats it!

  • Optionally, you can access the actual webkit2png query being sent with this method:
$webkit2png->getQuery();

Available Options

Option Example
width 1280
height 800
zoom 2.0
fullsize true
thumb true
clipped true
clipped-width 1000
clipped-height 800
scale 3.0
dir 'images/'
filename 'image'
md5 true
datestamp true
delay 3
js '\'javascript string here\''
no-image true
no-js true
transparent true
user-agent '\'user agent string here\''

Keep in mind that for js and user-agent, you must either use double quotes or escape single quotes so that the string passed is wrapped by quotes.

TODOs

  • Add validation
  • Complete Readme
  • Composer

About

PHP wrapper for webkit2png

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages