开发者

Saving Div Contents or Canvas as Image

I have read a few similar questions and answers, but none completely address my issue.

Here is My Scenario: I have what is similar to a tinyMCE (a home-brew version though) kind of editor. It lets users enter some text, and an image or two, etc. I have code that takes the items in there and renders them into a smaller div (what is essentially a thumbnail) in real time.

Here is What I Want to Do Ultimately, the user may want to use their 'page' somewhere else, so I would like to let them go to a screen, view thumbnails of each page, and pick one.

Here is the Problem Obviously, I could just use the same thumbnail code to render each page thumbnail. However, it can be bandwidth intensive (each page could have several images, not to mention the calculation would have to be performed many times - we are talking perhaps 40 to 50 thumbnails on a preview page).

So, I wanted to try to take the thumbnail div, and somehow create a png or jpg when they save th开发者_运维技巧e page in the editor (so the code for the page, and also a thumbnail image), and push it up to my PHP script to save the image to the server.

My first thought was that maybe canvas could do that, but there is the issue of translating the text and images onto the canvas first, which may or may not be possible.

So there it is. I am interested in any and all options, including commercial libraries if available that will do this -- only thing is, would like it to be in javascript.


You may want to look at: http://html2canvas.hertzen.com/

A similar question was already asked: Screen Grab with PHP and/or Javascript?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜