PHP Classes

File: examples/capture_to_file.php

Recommend this page to a friend!
  Classes of Lukasz Cepowski   WebThumbnail   examples/capture_to_file.php   Download  
File: examples/capture_to_file.php
Role: Example script
Content type: text/plain
Description: Example, how to capture a website screenshot and save the image into a disk file.
Class: WebThumbnail
Capture a screenshot of a page using WebThumbnail
Author: By
Last change: Update of examples/capture_to_file.php
Date: 8 months ago
Size: 414 bytes
 

Contents

Class file image Download
<?php

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

$path = tempnam('/tmp', 'webthumbnail-');

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

@
chmod($path, 0644);
echo
"Your thumbnail has been saved to ".$path;