Screen Grab with PHP and/or Javascript?
Asked Answered
F

6

0

Just wondering if it's possible to screen grab a page you are viewing with a PHP script or javascript? For example, load up a page in an iframe and then save that view as a JPEG?

I'm sure it's possible somehow, but are there any known implementations/libraries that help out?

Freetown answered 10/10, 2008 at 22:18 Comment(1)
there was a similar questionTriiodomethane
A
2

http://html2canvas.hertzen.com/ might do the trick.

Arak answered 30/8, 2011 at 11:1 Comment(0)
L
5

Nope, sorry, it is impossible with Javascript and definitely impossible with a server-side language like PHP. (Edit: I mean it's impossible to take a screenshot of the user's view of the page.)

It depends on what you want to do this for, but you might want to find a script or program that runs server-side and renders the webpage there. But if you really want to take the screenshot of the user's view of the page, it's pretty much impossible.

Leary answered 10/10, 2008 at 22:26 Comment(0)
H
2

There is a python tool called Webkit2png, hope it helps. But in PHP, i don't believe its possible

Halvah answered 10/10, 2008 at 22:24 Comment(0)
D
2

You can't do it in JS but you could do something similiar server side if you know the url of the page you want to convert to an image.

Tools like khtml2png could be called from php to render the page.

Degression answered 10/10, 2008 at 22:26 Comment(0)
A
2

http://html2canvas.hertzen.com/ might do the trick.

Arak answered 30/8, 2011 at 11:1 Comment(0)
D
1

Possible with the GD2 extension and some knowledge of the internals you are capturing - read here for an example.

Dyer answered 10/10, 2008 at 22:32 Comment(0)
F
0

Thanks for the help guys. I did find this interesting resource:

http://www.zubrag.com/scripts/website-thumbnail-generator.php

It's not PHP specific by any means, just an example of running an EXE script that is called by PHP. Needs a windows server I believe though.

Freetown answered 10/10, 2008 at 22:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.