Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate image from DOM elements

Is it possible to generate an image from dom elements (span, div, image, etc.)? I can't use canvas in this case, and it doesn't have to be cross-browser compatible, as long as it works in some browser. :-)

Thanks!

community edit: "So I take it that the client can already display these elements just fine, but you want the server to be able to, for example display a preview image around the site?" "Yup, exactly. Just a little preview so they can see what diagram they're opening, and the preview will also be used in other little places, too."

like image 998
Leticia Meyer Avatar asked May 28 '11 15:05

Leticia Meyer


1 Answers

If you want to duplicate it to some other location, you can use -moz-element, an experimental non-standard feature in Firefox which will let you take any piece of the DOM, and use it as for example a background image. https://developer.mozilla.org/en/CSS/-moz-element

Similar hacks can be done in webkit by abusing -webkit-box-reflect.

like image 97
ninjagecko Avatar answered Sep 28 '22 06:09

ninjagecko