Monday, November 12, 2012

PHP script to create WEB THUMBNAIL /SCREENSHOT


Do you want to make webthumbnail? What's that ya 'WebThumbnail'? Web thumbnail is a kind of image capture screen shots or the result of the appearance of a particular website. Thumbnail Web can actually be made ​​manually but very complicated because you have to open a web site that would captured zoom, then the software you need to capture a particular image zoom, and then save the results captured into an image file. Complicated right? But now you do not need to be complicated anymore, because there is already a PHP script to ease the process of making these thumbnails web.
To create a web thumbnails with PHP script, you do not bother him because it has provided a class that you can use for free or free. Give thanks to Lukasz Cepowski, which has made PHP class for web thumbnail. Feel free to download the script webthumnail.php diwww.phpclasses.org
Script Class webthumbnail made ​​by Lukasz Cepowski utilizes APIs from services webthumbnail.org a site that lets generate a screen shot of a web site.
Once the file has been downloaded webthumbnail.php, then how to use them?
Here is an example script to create web thumbnail or view website capturing and storing the file into a directory capturenya.

capture1.php
<?php
require 'webthumbnail.php';

// path file hasil capture
$path = 'd:/images/thumb.jpg';

$thumb = new Webthumbnail("http://blog.rosihanari.net");
$thumb
    ->setWidth(512)
    ->setHeight(512)
    ->captureToFile($path);

echo "Thumbnail sudah disimpan di ".$path;
?>
Examples of the above script when executed will capture views of the site and then save the file http://blog.rosihanari.net capturenya in d :/ images / thumb.jpg. The results captured image size is 512 x 512 pixels. Anyway, make sure his script webthumbnail.php located in the same folder as the capture1.php.
or you can also view results capturenya image directly into the browser, simply by making the script as follows:

capture2.php
<?php
require 'webthumbnail.php';

$thumb = new Webthumbnail("http://blog.rosihanari.net");
$thumb
    ->setWidth(512)
    ->setHeight(512)
    ->captureToBrowser();
?>
Image types generated from the above script is PNG image.
OK, easy right? good luck with ya ...:

1 comment: