I am drawing on canvas, I want to draw on the image and then save the modified new image drawing instead of the old image on the server, how can I do this?
var img = document.getElementById('img');
var canvas = document.getElementById('can');
var dataURL = canvas.toDataURL();
$.ajax({
type: "POST",
url: "canvas_ajax_upload.php",
data: { img: dataURL }
}).done(function(msg){
alert(msg);
});
In HTML:
<img style="position:absolute;top:10%;left:10%" width="833" height="602" id="img" src="http:..../Picture3.png"/>
<img style="position:absolute;top:10%;left:10%" width="833" height="602" id="img" src="<?=$image?>"/>
I want to save both the image and the canvas is drawn.
In this way, I'm only saving what drawn on the canvas.