PHP Classes

WebThumbnail: Capture a screenshot of a page using WebThumbnail

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-09 (9 months ago) RSS 2.0 feedNot enough user ratingsTotal: 2,035 All time: 1,929 This week: 73Up
Version License PHP version Categories
webthumbnail 1.10BSD License5.3PHP 5, Web services, Geography
Description 

Author

This class can capture a screenshot of a page using WebThumbnail.

It can send a HTTP request to the WebThumbnail API Web server to request the capture of a screenshot of a given URL.

The service will queue the request to capture the specified page screenshot using one of the supported browsers: Firefox, Google Chrome or Opera.

The screenshot image may be capture with sizes between 70 by 70 and 2048 by 4096 pixels.

The class polls the capture server to determine when the screenshot is ready to download.

The retrieved screenshot image can be copied to a local file or served for download as the current script output in the PNG, JPEG or GIF formats.

Innovation Award
PHP Programming Innovation award nominee
May 2012
Number 2


Prize: One subscription to the PDF edition of the PHP Architect magazine
Some sites need to show previews of how a page of another site looks.

This class can generate image previews of a given site page using the WebThumbnail service.

Manuel Lemos
Picture of Lukasz Cepowski
Name: Lukasz Cepowski <contact>
Classes: 3 packages by
Country: Poland Poland
Age: 36
All time rank: 118929 in Poland Poland
Week rank: 215 Up2 in Poland Poland Up
Innovation award
Innovation award
Nominee: 1x

Recommendations

Example

<?php

error_reporting
(E_ALL);
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
$root = dirname(dirname(__FILE__));
require
$root.'/webthumbnail.php';

$thumb = new Webthumbnail("http://webthumbnail.org");
$thumb
   
->setWidth(320)
    ->
setHeight(240)
    ->
setScreen(1280)
    ->
captureToOutput();


Details

              _     _   _                     _                 _ _
__      _____| |__ | |_| |__  _   _ _ __ ___ | |__  _ __   __ _(_) |
\ \ /\ / / _ \ '_ \| __| '_ \| | | | '_ ` _ \| '_ \| '_ \ / _` | | |
 \ V  V /  __/ |_) | |_| | | | |_| | | | | | | |_) | | | | (_| | | |
  \_/\_/ \___|_.__/ \__|_| |_|\__,_|_| |_| |_|_.__/|_| |_|\__,_|_|_|

                     http://webthumbnail.org

           The simplest way to get a website screenshot!

This repository contains legacy code and is no longer maintaned!

The Webthumbnail.org has recently been rebranded to Miniature.io.<br /> Visit Miniature.io for more information and new PHP client library.

1) What is webthumbnail.org? The webthumbnail.org is a free webapi for capturing website screenshots. Shortly speaking it is an web based application that you can simply integrate with your website and have thumbnails of any website on demand.

This project is a simple php client for using the api.webthumbnail.org directly from the php code. It can be used in any php application, distributed under the terms of the BSD license.

2) How to use the api? The simples case is to just call the api from pure html code.

<img src="http://api.webthumbnail.org?width=512&height=512&format=png&browser=firefox&url=http://webthumbnail.org" alt="Captured by webthumbnail.org" />

It will show a screenshot of http://webthumbnail.org directly on your website.

3) How to capture a website screenshot from php?

$thumb = new Webthumbnail("http://webthumbnail.org"); $thumb

->setWidth(512)
->setHeight(512)
->captureToOutput();

4) How to capture a website screenshot and save it to a disk file?

$thumb = new Webthumbnail("http://webthumbnail.org"); $thumb

->setWidth(512)
->setHeight(512)
->captureToFile($path);

5) Need more info? Visit http://webthumbnail.org

Feel free to test and use the application :)


  Files folder image Files (6)  
File Role Description
Files folder imageexamples (3 files)
Accessible without login Plain text file .project Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Plain text file webthumbnail.php Class The PHP wrapper class for http://webthumbnail.org

  Files folder image Files (6)  /  examples  
File Role Description
  Accessible without login Plain text file capture_to_browser.php Example Example, how to capture a website screenshot and send the image to the browser.
  Accessible without login Plain text file capture_to_file.php Example Example, how to capture a website screenshot and save the image into a disk file.
  Accessible without login Plain text file capture_without_delay.php Example Example script

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  
 100%
Total:2,035
This week:0
All time:1,929
This week:73Up