How can I create image from html using PHP?
something like painty but with advanced options having div, font, fontsize, style... etc....
I would like to have a coupon design in html and output it as an image.. preferably JPG..
but painty is not supporting those.
you can find here.. htt开发者_StackOverflow社区p://www.rabuser.info/painty.php the painty code i am using right now.
Thanks and waiting for the reply.
Creating this with pure php is bad idea, this will be slow as hell.
As far as I know in production this is achieved with external screenshot app and standard browser run by exec()
or similar function.
There's khtml2png, which renders the whole page and takes a screenshot; however, it's a standalone executable (and it needs an X server or xvfb), so you need to be able to run it on your server (so probably not on a shared hosting). This may be a bit of an overkill, but it gives you complete control over the final appearance.
You could also use some of the HTML to PDF convertors and then use ImageMagick to convert the PDF to JPEG.
精彩评论