0

I have thousands of pieces of HTML code that I want to take a screen shot of and save as an image. I'm no programming genius, but I think I can make this happen. I have a dedicated Linux server running Ubuntu with PHP5.

I've found tons of links about this, but no examples. I see talk about different libraries, existing sites, doing it with Windows, and python, but no concrete examples. Here are a few:

http://www.daniweb.com/forums/thread233211.html
http://cn.php.net/manual/en/function.imagegrabwindow.php
http://notan00b.com/2009/09/php-to-create-website-thumbnails/
http://synapticart.net/generate-web-thumbs-php-win-or-linux/
http://www.zubrag.com/forum/index.php?topic=82.0
http://linux.dtbaker.com.au/post/website_screenshot_thumbnail_creator_script.html
http://www.coderholic.com/pywebshot-generate-website-thumbnails-using-python/
http://github.com/coderholic/PyWebShot
http://v02.browsershots.org/trac/wiki/HowToInstallShotServer

Lot's to look through there, I want people to know I search for info on this. Also, hopefully this will help someone when they are looking for information.

Does anyone have something like this up and running? Any tutorials out there, or something that at least lists all the different components that are needed?

Thanks!

3
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by pritaeas
-1

If I was going to take a screenshot,I would use the Print Screen or Snipping Tool facilities in Windows. I don't understand why you would want to do this in PHP. If you are running under Linux then I'm sure there are similar facilities available. It's a manual process of course, so it would be very time consuming to do thousands. Since you must run the html scripts to get to the appropriate pages, I don't see how this could be automated.

1

The python solution at coderholic seems to be the most viable one. It only requires python and a running X. If you manage your own server, than it could be done. However if you use a hosted server, you won't have X running.

0

Yes, I manage the my own server, I just don't know how to run X or anything about python.

0

I tried learning more about the coderholic link. Here is what I understand:

1) Need to install the python-gtkmozembed package.
2) Need to upload the pywebshot.py file somewhere.
3) It looks like I can run python script with php. I can just build this dynamically based on the URL I want to take a shot of. The code I would use:

shell_exec('pywebshot.py -f /var/www/example.com/thumbnails/google.png google.com');

4) If the python script was in the same folder as the file calling it, would I use this?

shell_exec('/var/www/example.com/pywebshot.py -f /var/www/example.com/thumbnails/google.png google.com');

Do I need to do anything special to be "running X?" What else am I missing?

Edited by racertim: n/a

0

Not sure, the requirement is that X is running, because it needs to be to take the actual screenshot. I did not find anymore specifics on that site, perhaps it is best to ask him about it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.