Creating an Image from a DIV

I browsed Google and Stackoverflow and cannot find the final answer.

I want to create an image from a specific piece of content. So, I have a div that I added images, text, background colors, etc., and I want to save this DIV as an image. I read about GD and how to create each individual bit, for example, first create a canvas, fill it with color, render fonts, etc. .... What is interesting to me, isn't it easier? This seems like a straightforward task, but I don't appreciate it. Are there any libraries that you could recommend that this helps? Instead of going through the rendering of each image, every bit of text and every color on the canvas.

thank

+5
source share
3 answers

PHP doesn't know what your page looks like.

What the browser / user agent does (HTML rendering).

Check out: Website Screenshots Using PHP

+3
source

Div is not an image. In real life, this is a plastic bag in which you place products. What you want is an object <canvas>whose contents can be written as an image using various javascript functions.

+1
source
+1

All Articles