PHP Classes

PHP Ultimate Web Page Capture: Capture Web page as image using ScreenshotLayer

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 73%Total: 2,851 All time: 1,320 This week: 43Up
Version License PHP version Categories
screenshot 1.0GNU General Publi...5.4HTML, PHP 5, Graphics, Web services
Description 

Author

This class can capture Web page as image using ScreenshotLayer API.

It can send a HTTP request to the ScreenshotLayer API to request the capture of an image in PNG, JPG or GIF formats from a given URL.

It can capture an image for the full page or only the visible viewport at a given size.

A given CSS may be injected in the captured page. A custom user agent string may be sent to the page Web server to emulate certain device browsers. The API may delay the capture for a given period of time.

The captured image can be resized to a given width and height. The capture results may be cached for a given period of time.

The class can return the captured image as HTML image tags, save the image to file or serve for display. The API may serve a custom placeholder image while the capture is not fully ready.

Picture of Dave Smith
  Performance   Level  
Name: Dave Smith is available for providing paid consulting. Contact Dave Smith .
Classes: 51 packages by
Country: United States United States
Age: 59
All time rank: 608 in United States United States
Week rank: 48 Up7 in United States United States Up
Innovation award
Innovation award
Nominee: 32x

Winner: 7x

Recommendations

PHP Ultimate Web Page Capture
Take automatic snapshot of website

Example

<?php
/*
example usage
screenShot ver 1.0
*/

//include screenShot class
include('screenshot.class.php');

//instantiate the class with the webpage url to capture
$screenShot = new screenShot('http://www.website.com');

//display html image tag for captured webpage
$screenShot->displayImage();

/*
The following demonstrates the download and display from captured binary
of the webpage. To use, uncomment the capturePage method to capture
the binary and then uncomment either the downloadCapture or displayCapture
methods, depending on which you wish to preform.
*/

//$screenShot->capturePage();

//$screenShot->downloadCapture('test.png');

//$screenShot->displayCapture();

?>


Details

Class: screenShot Version: 1.0 12/7/2015 Copyright 2015 Wagon Trader, All Rights Reserved Description: Capture image of webpage using the screenshotLayer API from http://www.screenshotlayer.com. Files: screenshot.class.php - main class example.php - basic usage Installation: Upload files to a web accessible location on your server (eg. public_html) Configuration: You can change the following settings in the class to meet your specific needs... apiKey = Your personal API Key, get a free key at https://screenshotlayer.com/product endpoint = The API endpoint, you will only need to change this if the API changes location. secretKey = If you have defined and activated the secret keyword feature from you screenshotlayer dashboard, add your secret keyword here. Usage: refer to example.php file for class instantiation and basic usage. refer to screenshot.class.php for instructions on using methods. The screenshotlayer API will first attempt to retreive the image from the cache, if not found it will then produce a new image. Images returned from the cache will not be charged against your monthly usage. Customizing the captured image: In addition to the url, you can set the following params to further customize the returned image. You can use the setParam method to add/change any param. fullpage - set to 1, to capture entire webpage width - specify width in pixels to resize capture viewport - the width and height in pixels for fit to a device viewport Default: viewport=1440x900 format - returned image format of PNG (default), JPG or GIF css_url - url of css to inject into page before capture delay - delay time in seconds before capture starts ttl - seconds to hold image in cache Default/Max: ttl=2592000 (30 days) force - set to 1 to force new capture placeholder - url to placeholder image while capture is running or 1 to use default user_agent - custom user agent string. Use to send this string as the user agent to the website in conjuction with the viewport to emulate the desired device. accept_lang - custom accept language header. Some premium accounts also have access to the following params. export - export the capture image to a specified location export=s3://[bucket api key]:[bucket secret key]@[bucket] will export to AWS S3 bucket export=ftp://[user]:[password]@[ftp server][/path/to/folder] will upload to folder using FTP Changelog: 1.0 Initial Release

  Files folder image Files (4)  
File Role Description
Accessible without login Plain text file example.php Example Example Usage
Accessible without login Plain text file license.txt Lic. License
Accessible without login Plain text file manual.txt Doc. Documentation
Plain text file screenshot.class.php Class Main Class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:2,851
This week:0
All time:1,320
This week:43Up
User Ratings User Comments (3)
 All time
Utility:91%StarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:91%StarStarStarStarStar
Examples:91%StarStarStarStarStar
Tests:-
Videos:-
Overall:73%StarStarStarStar
Rank:130
 
paid version bah!
6 years ago (K)
0%Star
Fantastic package.
8 years ago (Michael Scott McGinn)
80%StarStarStarStarStar
this is nice work.
8 years ago (Thouhedul Islam)
80%StarStarStarStarStar