Yes I have Done This Using html2canvas function but this is quite complex
Download Html2canvas from read the documentation
https://github.com/niklasvh/html2canvas/releases
You need to have 2 page
a) One HTML page with Javascript on it
b) another page to handle the request from this page(better if you ajax to pass the request)
html2canvas($("#droppable2") , {
onrendered: function(canvas) {
dataURL = canvas.toDataURL("image/png");
$(image_id).attr('src','images/ajax_loader.gif'); //show a loader while the request is being forwared
$.ajax({
type: "POST",
dataType: "json",
url: "saveimage.php", //second file
data: {data:dataURL},
success: function(data) {
image = data.data;
source = 'template_images/'+username+"/"+magz_name+"/"+image+"?a="+Math.random(); // image name
$(image_id).attr('src',source); // set the source of new image with dynamically generated image
});
});
on the second page
use base64_decode() function to get the content of this image and put this in a new file
<?php
$data = $_REQUEST['data'];
$rawImage =$data;
$removeheaders =substr($rawImage,strpos($rawImage,",")+1);
$decode = base64_decode($removeheaders);
$fopen =fopen('newfile.png','wb');
fwrite($fopen,$decode);
$arr = array('data' => 'newfile.png','username' => $username );
echo json_encode($arr);
?>