0

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

3
  • You're saying you want to render the HTML/CSS into an image? Commented Nov 10, 2011 at 0:28
  • what about a screenshot instead? Commented Nov 10, 2011 at 0:35
  • 1
    check this out: stackoverflow.com/questions/721549/… Commented Nov 10, 2011 at 0:38

1 Answer 1

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)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.