Using linux and opera for dynamic web screenshots

I recently had a need to take screenshots of webpages dynamically. What I came up with was a simple PHP cron and que that calls a very basic shell script.

export DISPLAY=":1"
/usr/bin/opera -remote "raise()"
/usr/bin/opera -remote "openURL($1)" & 
/bin/sleep $6
/usr/bin/import -window root -display :1 -resize $3x$4 -quality $5 "$2"

I then call this script with a command in php /tmp/tempfile.jpg 1024x768 75 15

This will take a load for 15 seconds and save a 1024x768px screenshot to /tmp/tempfile.jpg