How to get a snapshot or thumbnail of a webpage using PHP?

I need to create Snapshots / Thumbshots / Preview the site a-site.com.

There is some site like thumbshot.org that matches me. But I do not want to use an external service, and not depend on others for my project (what happens if they close the site?)

For this reason, I am looking for some kind of project to allow me to do this.

Any idea?

+3
php thumbnails screenshot webpage
Jan 14 '09 at 17:05
source share
5 answers

There is nothing in the PHP library that could be done - you want to configure an external application (with a queue) to receive images, although you can, of course, use PHP to add elements to the queue.

There are several Windows functions in GD that take screenshots of a computer (a web server, not a client), so maybe you can write a script in PHP for this.

Edit: Thought of it: imagegrabscreen and imagegrabwindow . I'm not sure that they will do what you want (even in full screen mode, Firefox has an ablue panel at the top of the screen - not sure about other browsers). However, Pierre has something for these functions if you are interested.

I would suggest writing an application in another language (I assume .NET has something) to do this for you. Edit: This page tells you how to do this in C #

+1
Jan 14 '09 at 17:11
source share

In windows you can use the GD function imagegrabwindow() .

Edit: The help page actually shows you how to capture a screenshot from IE.

+1
Jan 14 '09 at 17:11
source share

There is not much PHP for you in this situation. You will need a complete (X) HTML rendering engine with CSS support, possibly also with JavaScript support.

What, or use some weird script that would launch a real browser, and take a screenshot of it. In any case, PHP is probably not the right tool for the operating part.

0
Jan 14 '09 at 17:11
source share

There is a Firefox extension that converts the web page you are viewing into an image:

http://www.screengrab.org/

http://addons.mozilla.org/en-US/firefox/addon/1146

If you are ready for creativity, you may have access to this problem.

0
Jan 14 '09 at 22:28
source share

Thanks to everyone. I found a pseudo-solution (using dcom + imagegrabscreen + wamp). I need to resize final.png with gd, because png is equal to the resolution of the client (in my house - image 1650 * 1280). I finished this, I will send the .zip file for download thanks again (But if anyone has a better idea, I am glad to see it)

PS: Sorry for my English

0
Jan 15 '09 at 4:23
source share



All Articles