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

roozbubu
  • 1,106
  • 4
  • 14
  • 30

1 Answers1

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)

Community
  • 1
  • 1
Oliver A.
  • 2,870
  • 2
  • 19
  • 21