Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save webpage as a image file using PHP?

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.

like image 984
Manthan Desai Avatar asked Dec 12 '22 21:12

Manthan Desai


2 Answers

Check out http://browsershots.org/ and Webkit2Png

like image 126
nikc.org Avatar answered Jan 29 '23 19:01

nikc.org


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

like image 36
Aaron Harun Avatar answered Jan 29 '23 19:01

Aaron Harun