kjung / webkit2png-php
PHP wrapper for the webkit2png binary on OS X.
Installs: 80
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 5
Open Issues: 0
pkg:composer/kjung/webkit2png-php
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-11-03 20:27:34 UTC
README
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
- webkit2png binary
- PHP 5.3 or greater
- Shell access
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