Skip to content
This repository has been archived by the owner on Jul 15, 2020. It is now read-only.

The Yii PhantomjsWebpageScreenshot extension that allows to generate screenshots of web pages on the fly.

License

Notifications You must be signed in to change notification settings

zero-archive/yii-phantomjs-screenshot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii Phantomjs WebpageScreenshot

Latest Stable Version License

The Yii PhantomjsWebpageScreenshot extension that allows to generate screenshots of web pages on the fly. It uses the headless webkit PhantomJS as a capture-engine.

PhantomJS is a headless WebKit with JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.

Requirements:

Install

Via composer:

$ composer require dotzero/yii-phantomjs-screenshot

Add vendor path to your configuration file, attach component and set properties.

'aliases' => array(
    ...
    'vendor' => realpath(__DIR__ . '/../../vendor'),
),
'components' => array(
    ...
    'screenshot' => array(
        'class' => 'vendor.dotzero.yii-phantomjs-screenshot.EWebpageScreenshot',
        //'phantomjs' => '/bin/phantomjs',
        //'width' => 640,
        //'height' => 480,
    ),
),

Usage:

$screenshot = Yii::app()->screenshot;
$screenshot->width = 640;
$screenshot->height = 480;

$url = 'http://www.google.com';
$outfile = Yii::getPathOfAlias('application.runtime') . '/' . uniqid() . '.png';

$screenshot->capture($url, $outfile);

License

Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

About

The Yii PhantomjsWebpageScreenshot extension that allows to generate screenshots of web pages on the fly.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published