I want to save webpage as image file or i want to take snapshot of an webpage using PHP. Just like firefox extension Fireshot doing.
-
check out this discussion: http://stackoverflow.com/questions/757675/website-screenshots-using-php – Sergey Eremin Jul 04 '10 at 16:41
-
4or this one http://stackoverflow.com/questions/686858 or http://stackoverflow.com/questions/713938 or http://stackoverflow.com/questions/1952570 or http://stackoverflow.com/questions/1340917 or http://stackoverflow.com/questions/65078 or http://stackoverflow.com/questions/834445 or http://stackoverflow.com/questions/3022338 or http://stackoverflow.com/questions/1077970 – BlueRaja - Danny Pflughoeft Jul 04 '10 at 16:51
4 Answers
You'll need to render the page with something. If you really want to only use php, i suggest you HTMLTOPS, wich render the page and output it in a ps file (ghostscript), then, convert it in a .jpg, .png, .pdf.. can be little slower with complex pages (and dont support all the CSS).
Else, you can use wkhtmltopdf to output a html page in pdf, jpg, whaterver.. Accept CSS2.0, use the webkit (safari's wrapper) to render the page.. so should be fine. You have to install it on your server, as well..
Source: Website screenshots using PHP

- 1
- 1

- 32,415
- 8
- 47
- 61
Like others have said, it would be difficult to do in PHP alone. However, there is an easy-to-use cross-platform tool called CutyCapt that does exactly what you need. The best part about this tool is that it's stand-alone and doesn't depend on anything else.

- 69,683
- 7
- 133
- 150
You cannot do this with pure PHP, try forking a browser like Mozilla with headless mode and let it handles taking snapshot of the page.

- 10,136
- 6
- 48
- 55