Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating an Image from a DIV

Tags:

php

png

I've scoured Google and Stackoverflow and can't seem to come up with a definitive answer.

I'm wanting to create an image from a particular bit of content. So I've got a div which I've added images, text, background colours etc. to and I'm wanting to save out that DIV as an Image. I've read on GD and how to create each individual bit, like creating the canvas first, filling it with a colour, rendering the fonts etc... What I'm wondering, is there not an easier way? It seems like a straight forward task but I appreciate it's not. Are there any libraries that you could recommend that will aid this? Rather than having to go through rendering each image, each bit of text and each colour on the canvas..

Thanks

like image 311
christian.thomas Avatar asked Aug 17 '11 22:08

christian.thomas


1 Answers

PHP has no idea what your page looks like.

That's stuff a browser / user-agent does (rendering HTML).

Check out: Website screenshots using PHP

like image 193
PeeHaa Avatar answered Sep 30 '22 12:09

PeeHaa