Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zero-archive/yii-phantomjs-screenshot
The Yii PhantomjsWebpageScreenshot extension that allows to generate screenshots of web pages on the fly.
https://github.com/zero-archive/yii-phantomjs-screenshot
phantomjs php screenshot yii yii-framework
Last synced: 6 days ago
JSON representation
The Yii PhantomjsWebpageScreenshot extension that allows to generate screenshots of web pages on the fly.
- Host: GitHub
- URL: https://github.com/zero-archive/yii-phantomjs-screenshot
- Owner: zero-archive
- License: mit
- Archived: true
- Created: 2012-11-01T07:40:19.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2016-04-30T08:24:07.000Z (over 8 years ago)
- Last Synced: 2024-09-23T22:02:47.709Z (4 months ago)
- Topics: phantomjs, php, screenshot, yii, yii-framework
- Language: PHP
- Homepage: https://github.com/dotzero/yii-phantomjs-screenshot
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Yii Phantomjs WebpageScreenshot
[![Latest Stable Version](https://poser.pugx.org/dotzero/yii-phantomjs-screenshot/version)](https://packagist.org/packages/dotzero/yii-phantomjs-screenshot)
[![License](https://poser.pugx.org/dotzero/yii-phantomjs-screenshot/license)](https://packagist.org/packages/dotzero/yii-phantomjs-screenshot)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:
- [Yii Framework](https://github.com/yiisoft/yii) 1.1.14 or above
- [Composer](http://getcomposer.org/doc/)## Install
### Via composer:
```bash
$ composer require dotzero/yii-phantomjs-screenshot
```### Add vendor path to your configuration file, attach component and set properties.
```php
'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:
```php
$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