2017 © Pedro Peláez
 

library phantomshot

PHP tool to make web-shots using PhantomJS

image

codegyre/phantomshot

PHP tool to make web-shots using PhantomJS

  • Wednesday, January 22, 2014
  • by lividgreen
  • Repository
  • 4 Watchers
  • 24 Stars
  • 635 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

PhantomShot

PHP tool to make web-shots using PhantomJS, (*1)

Installation

add composer requirements

"require": {
    "codegyre/phantomshot": "dev-master"
}

add post-install and post-update hooks to your composer.json

"scripts": {
    "post-install-cmd": [
        "Codegyre\\PhantomShot\\ComposerHook::hook"
    ],
    "post-update-cmd": [
        "Codegyre\\PhantomShot\\ComposerHook::hook"
    ]
}

We need this to install required dependencies through npm., (*2)

Making webshot

$webPage = new \Codegyre\PhantomShot\WebPage('http://github.com');
$webPage->getShot('/tmp/github.png');

Thumbnailing

$tc = new \Codegyre\PhantomShot\ThumbnailCollector('http://github.com');
$tc->createThumbnail('/destination/dir/1.png', 200, 400, ThumbnailCollector::TRANSFORM_FILL_HEIGHT_MIDDLE);
$tc->createThumbnail('/destination/dir/1.png', 350, 160, ThumbnailCollector::TRANSFORM_FILL_WIDTH_MIDDLE);

Make sure you have npm installed on your system, (*3)

Using as service

You have a possibility to use phantomshot as a web service to get website screenshots, (*4)

cd src/js && ./phantomshot-service.js --port=3000

It will start http server on localhost:3000. Usage:, (*5)

http://localhost:3000/?width=1024&height=768&url=http://example.com

The Versions

22/01 2014

dev-master

9999999-dev http://codegyre.com

PHP tool to make web-shots using PhantomJS

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Nick Palamarchuk

screenshot webshot pageshot