Does anybody know if it is possible to g开发者_如何学Pythonrab a capture of a particular div using php? What I would like to do is have a drag and drop container where users could potentially position a number of images using javascript and then I would like them to be able to save a copy of the result as a single image.
Thanx in advance
My guess would be, work out the coordinates of the images placed with javascript and assign them to a hidden form field. Then save it using PHP and store the coordinates in the database...
You can use canvas.toDataURL()
from the html 5 canvas element to save it into a image file. You can get more info Here.
You can load the images into a canvas field (drawImage()
) and implement drag and drop functions. If the user presses the send button, the canvas will be converted to a data URL with canvas.toDataURL()
.
But I think it's simplier when you only save the coordinates and let PHP merge the images.
What you want to achieve can be done only with javascript. And if you need the image on server, you can sent it by ajax.
Take a look at this jQuery tutorial which does something close that you want. (demo)
精彩评论