PHP Classes
elePHPant
Icontem

GtkMozEmbed Screenshot: Take page screenshots on Linux with Mozilla widget

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   Videos Videos   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2008-08-03 (7 years ago) RSS 2.0 feedNot enough user ratingsTotal: 1,451 All time: 2,553 This week: 1,104Up
Version License PHP version Categories  
gtkmozembed-shot 0.1.0GNU General Publi...5.1.0PHP 5, Graphics, Unix, GUI
Description Author  

This class can be used to take screenshots of Web pages using Mozilla embedded GTK widget.

It creates a graphical user interface window using PHP-GTK 2 that contains a GtkMozEmbed browser widget.

The browser gadget is pointed to a given URL and the class saves the page as to a image file in PNG format when the page stops loading.

The class works in Linux/UNIX and other platforms that support the GtkMozEmbed widget.

Innovation Award  
PHP Programming Innovation award nominee
August 2008
Number 5


Prize: One book of choice by O'Reilly
Some sites need to generate screenshots of Web site pages to show how certain pages look site.

There have been solutions that use Internet Explorer to load and capture Web site page screenshots using PHP. However, such solutions only run on Windows.

This class provides an alternative solution to take screenshots of pages that can run on Linux and platforms that support PHP-GTK 2 and the GtkMozEmbed widget.

This way it can generate screenshots of what a page looks like on Firefox or other browsers based on the Gecko engine.

Manuel Lemos
Picture of Daniel Anechitoaie
Name: Daniel Anechitoaie <contact>
Classes: 1 package by
Country: Romania Romania
Age: 29
All time rank: 175742 in Romania Romania
Week rank: 1555 Up34 in Romania Romania Up
Innovation award
Innovation award
Nominee: 1x

Details provided by the author  
To get this running you need a linux box and php5 with Gtk and GtkMozEmbed installed.

First install this packages:
    php5-cli 
    php5-dev                     
    libglib2.0-dev 
    libgtk2.0-dev 
    libxul-dev
    
Then go to http://gtk.php.net/download.php and get the php-gtk-2.x.x source

Extract it in a place of your choice 
    tar -xzvf php-gtk-2.x.x.tar.gz
    
Run ./buildconf

Due to a nice little bug ( http://bugs.php.net/bug.php?id=44921 ) you need to apply the following patch
    http://pastebin.com/pastebin.php?dl=f60e601e7
    
Run ./configure and enable mozembed ( --with-mozembed )

Run make

Run make install as root

Edit your php.ini and load php_gtk2 extension

Try to enjoy the script :|


A video with this in action can be seen at http://www.youtube.com/watch?v=NUIvpnYflIk

This is a php inplementation of a script in python by Matt Biddulph ( http://www.hackdiary.com/archives/000055.html )
Videos  
  • take screenshots of a website using php gtk mozembed
  Files folder image Files  
File Role Description
Plain text file GtkMozEmbedScreenshot.php Class Screenshot class
Accessible without login Plain text file README.txt Doc. Readme

 Version Control Unique User Downloads Download Rankings  
 0%Total:1,451All time:2,553
 This week:0This week:1,104Up
 User Comments (1)