Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML div to screenshot?

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.

like image 255
ZolaKt Avatar asked Dec 27 '22 20:12

ZolaKt


2 Answers

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.

like image 61
Stefan Kendall Avatar answered Dec 30 '22 11:12

Stefan Kendall


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

like image 42
Jack Avatar answered Dec 30 '22 09:12

Jack