Hi,
Firstly, I apologize for my ignorance on this subject !
I have been looking for ways to get web-site screen shots from urls
to place on one of of my websites.
I found a neat solution but it needs a Windows server. My server is
running CentOS Linux 5.4 with Virtualmin version 3.75 Pro.
Then I found this script but I am not sure how to run it
Is the script in pearl ? I write in php so I donât know much about this
or how I can check if I have the required s/w on my server.
Here is the script:
I used the âcodeâ tags so I hope it will format OK on this page
#!/bin/sh
A script to take screenshots of webpages.
Example usage: webthumb.sh << END
http://www.mozilla.org mozilla.png mozilla_thmb.png
http://www.imagemagick.org imagemagick.png imagemagick_thmb.png
http://www.uk.research.att.com/archive/vnc/xvnc.html xvnc.png xvnc_thmb.png
END
Requires:
* ImageMagick
* Mozilla
* Xvnc (as Virtual X server), you might also fire up X.org for that purpose
Author: Henryk Gerlach (2005-01-01)
No warranty, use at own risk.
This script is Public Domain. All the hard work is done third party software
anyway.
#BUGS:
Mozilla:
* -geometry does not work with mozilla
* if mozilla already runs under the userid it might not start up.
* if mozilla needs to be configured for the userid running it, the script
wonât work
BROWSER=mozilla
#The window title of the browser after startup, so we can grab itâs window id.
#If all fails, take root to grab the whole desktop
BROWSERID=âMozillaâ
#BROWSERID=ârootâ
DISPLAY=":1"
#Use virtual X server
VIRTUAL_X=âXvnc -depth 16 -localhost -geometry 1024x768 $DISPLAYâ
#cut of browser decoration for 800x600 resolution
CROP=â800x490+0+90â
THUMBSIZE=â120x90â
INITTIME=5 #time to wait for the Xserver and the browser to start up
LOADTIME=4 #time to wait for a page to load, take shot after this time
######################################################
#init
if test â$VIRTUAL_Xâ != ââ; then
$VIRTUAL_X &
fi
export DISPLAY
sleep $INITTIME
$BROWSER &
sleep $INITTIME
if test â$BROWSERIDâ != ârootâ; then
BROWSERID=xwininfo -name "$BROWSERID" | grep "Window id" | cut -d " " -f 4
fi
loop
while read URL BIG THUMB; do
$BROWSER -remote âopenurl($URL)â
sleep $LOADTIME
import -window â$BROWSERIDâ $BIG
if test â$CROPâ != ââ; then
mogrify -crop $CROP â$BIGâ
fi
convert -size â$THUMBSIZEâ â$BIGâ -resize â$THUMBSIZEâ â$THUMBâ
done
#cleanup
#this is ugly
if test â$VIRTUAL_Xâ != ââ; then
killall Xvnc
else
killall $BROWSER
fi
Can anyone help me know how to use this and check for the required s/w ?
Thanks
Dave.