Script for taking webthumb using html2image tool

Steps

#cd /opt

#wget http://www.guangmingsoft.net/htmlsnapshot/html2image.i386.tar.gz

#tar xvzf html2image.i386.tar.gz

#cd html2image

#export LD_LIBRARY_PATH=./

Save the shell script without sh extenstion in /opt/websnap

file name

#!/bin/bash

#cd /opt/html2image

ls

export LD_LIBRARY_PATH=./

./Xvfb :1 -screen 0 1024x768x24 -nolisten tcp -audit 4 -auth X1.cfg & export DISPLAY=:1

./html2image $1 /home/test/public_html/$2

echo “html 2 image Done!”

Save the php script script wherever u want

PHP script (web_snap.php)

exec(“export LD_LIBRARY_PATH=/opt/”); // if html2image folder in /opt folder

// here html_2_image is above shell script

exec(“/opt/websnap www.google.com google.png”, $result, $returnValue);

?>

Execute “web_snap.php” with cron job, the result image will saved to “/home/siteroot /public_html/html2image/” folder.




Leave a Reply

Your email address will not be published. Required fields are marked *