diego
diego

Reputation:

How might I obtain a Snapshot or Thumbnail of a web page using PHP?

I need to create Snapshots / Thumbshots / Site preview a-site.com.

There are some site as thumbshot.org that meets with I need. But I do not want to use an external service, not to depend on others for my project (What would happen if they close the site?)

For this reason, I am looking for some project to let me do this.

Any idea?

Upvotes: 4

Views: 2702

Answers (5)

Ross
Ross

Reputation: 47007

There isn't anything in the PHP library to do this - you're looking at setting up an external application (with a queue) to take images, although you can of course use PHP to add items to the queue.

There are a couple of Windows functions in GD that takes screen shots of the computer (webserver - not the client) so perhaps you could write a script in PHP to do this.

Edit: Was thinking of these: imagegrabscreen and imagegrabwindow. I'm not sure they will do what you want however (even in full screen mode Firefox has ablue bar at the top of the screen - not sure about other browsers). However, Pierre has something on these functions if you're interested.

I'd 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 it in C#

Upvotes: 1

diego
diego

Reputation:

Thanks to all. I found a pseudo-solution, (using dcom + imagegrabscreen + wamp). I need to resize the final.png with gd, because the png is equal to resolution of client (in my home, is a picture of 1650*1280). Whe I end this, I will post a .zip file to dowload Thanks again (But if anyone have a better idea, I am happy to see that)

PS: Sorry for my english

Upvotes: 0

TravisO
TravisO

Reputation: 9540

There's a Firefox extension that converts the webpage you're viewing to an image:

http://www.screengrab.org/

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

If you're willing to get creative, it might be possible to access this problematically.

Upvotes: 0

Henrik Paul
Henrik Paul

Reputation: 67723

There's not much PHP would do for you in this situation. You'd need a complete (X)HTML rendering engine with CSS-support, possibly also with JavaScript support.

That, or use some kind of kinky script that would launch a real browser, and take a screenshot out of that. Either way, PHP is probably not the right tool for the operational part.

Upvotes: 0

Greg
Greg

Reputation: 321688

On windows you can use GD's imagegrabwindow() function.

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

Upvotes: 1

Related Questions