GithubHelp home page GithubHelp logo

webkit2png-php's Introduction

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

webkit2png-php's People

Contributors

alexchittock avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.