is there a way (hopefully through the GD library, but other ones are fine) to create an img from pure html (using php)? I need to fetch external sites and show icons. Im assuming an image method would save load time, but if not I could simply load in the html from the page into a div, as long as the inner html, head, and body tags dont cause problems
Asked
Active
Viewed 287 times
0
-
You're saying you want to render the HTML/CSS into an image? – Oliver Charlesworth Nov 10 '11 at 00:28
-
what about a screenshot instead? – Nov 10 '11 at 00:35
-
1check this out: http://stackoverflow.com/questions/721549/php-creating-image-from-html-table – Nov 10 '11 at 00:38
1 Answers
0
Rendering a complete Html page with PHP alone is not possible. Rendering an Html includes applying CSS load images and editing the whole thing with javascript and doing this with pure php would take ......well forever. Your best shot would be using a cmd tool to render the page and output an image. You can use shell commands in PHP.
Shell commands from PHP code: http://php.net/manual/en/function.shell-exec.php
Creating a screenshot: Command line program to create website screenshots (on Linux)