I know there is a lot of questions regarding this but currently I am trying to save canvas image to server, I recently start javascript so I meet lots of problem. I write image editor which allow user to save the canvas as an image file to server after editing is finished. but because image produce with dynamic src in canvas I cant save it with php. can any one help me with this problem??
my code
html2canvas([document.getElementById('dadycool')], {
onrendered: function (canvas) {
var data = canvas.toDataURL('image/png');
var image = new Image();
image.src ='data:image/jpeg;base64,""';
document.getElementById('imagec').appendChild(image);
$.ajax({
type: "POST",
url: "resize.php",
data: {
imgBase64: dataURL
}
}).done(function(o) {
console.log('saved');
});
}
my php code
echo '<div class="wifix">';
echo '<div class="dadycool" id="dadycool">';
echo '<div class="fixx" align="center"><img class="ui-widget-content" id="resizable" src="uploads/'.$ThumbPrefix.$NewImageName.'" alt="Thumbnail">';
echo '</div>';
echo '</div>';
echo '</div>';
echo '<div id="imagec"></div>';