HTML div to screenshot?

梦想的初衷 提交于 2019-12-23 18:17:55

问题


I tried to google it, but without much success.

Here is my problem:
I have something like a drag-and-drop game in jQuery, where the user drags some items (div with img) to the droppable drawing area.

I need a screenshot of the users design so I can put all designs into a gallery page.

My problem is how to get the HTML code into a jpeg/png/gif/canvas/whatever.
Btw. I'm on a shared PHP hosting on the server side.


回答1:


You're doing it wrong. Store each piece's location at all times in javascript, and then just submit that data and re-build the images/locations based on the passed javascript data.




回答2:


The functionality you are describing is extremely complex to write with PHP - but there are services such as www.thumbshots.com or www.browsershots.com that do the same thing. This question has been asked similarly many times before here:

https://stackoverflow.com/search?q=screenshots+with+php




回答3:


You want to build your game in canvas, which can then export itself out as a PNG file that you could then have submitted back to the server.



来源:https://stackoverflow.com/questions/6050953/html-div-to-screenshot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!