Monday, November 23, 2009

Screenshots in #php using #qt #python or #c++

I used the example from this article

and installed the needed libs on the server
sudo apt-get install libqt4-core libqt4-webkit python-qt4 xvfb


wget http://github.com/AdamN/python-webkit2png/raw/master/webkit2png.py


python webkit2png.py -x -o cnn.png --debug http://www.cnn.com

chmod +x webkit2png.py

from php

passthru("/home/mariuz/webkit2png.py -x -o /tmp/google.png --debug --scale 100 100 http://www.google.com")

i want to load a page with flash content , shameless plug reea.net

webkit2png.py –scale 200 200 -x -o reea.png –debug http://reea.net

but seems i have an flash error and the image is quite empty

Adobe Flash Player: gtk_clipboard_get(GDK_SELECTION_PRIMARY); failed. Trying to call gtk_init(0,0);
Xlib: extension “RANDR” missing on display “:99.0″.

also got the same error with gnash

I have investigated the c++ websnap examples from qt labs now hosted in git

http://labs.trolltech.com/blogs/2008/11/03/thumbnail-preview-of-web-page/

Another example in c++ is on this page and have made it compile on qt 4.5.3

and added

view->page()->settings()->setAttribute(QWebSettings::PluginsEnabled,true);

No comments: