Link to home
Start Free TrialLog in
Avatar of CongUan
CongUan

asked on

Convert HTML to Image

Hi Experts,

How can I convert HTML source to image (Run-Time on Server) by PHP language ?
Avatar of fulscher
fulscher

Converting HTML to an image implies rendering the HTML, a task which is usually done on the client side by the browser. Unless you find a way to encapsulate Mozilla into a php class, I don't think this can be done.

Sorry, Jan
What do you need?

It has non sense to convert to image something that is normally done by a browser...
Let me know
S_D
This can be done but you'd most likely need your own server dedicated for it..

PHP can run commands in the command line..

so you can make a script that would take the input of a form which would tell it what page to use and which browser to open it under.

the php script would launch the browser with that page through command line, then call the screenshot utility and save it to a path accessible to the server and return a path.

There are other things out there such as http://khtml2png.sourceforge.net/ to do so.

I don't think making one from scratch would be too hard. You just have to find a screenshot utility which you can run from command line and time it a certain amount of time after the launch of the browser.
ASKER CERTIFIED SOLUTION
Avatar of Sathallrin
Sathallrin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CongUan

ASKER

Sathallrin: "You cannot do this entirely with PHP, you would have to setup some programs on the server using one of these packages"

It's better to be sparing for setup some programs on the web server using one of these packages. No more any other solution ???