Convert HTML to Image

Hi Experts,

How can I convert HTML source to image (Run-Time on Server) by PHP language ?
CongUanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

fulscherCommented:
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
system_downCommented:
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
joebloe3000Commented:
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.
SathallrinCommented:
BrowsrCamp ( http://www.browsrcamp.com/ ) has a feature like this.
They are using the package at http://www.paulhammond.org/webkit2png/ to do it.  You could also use http://khtml2png.sourceforge.net/ as joebloe mentioned.

You cannot do this entirely with PHP, you would have to setup some programs on the server using one of these packages, and then use PHP to execute the commands via command line.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CongUanAuthor Commented:
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 ???
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.