mobomo/sketch.js

Get Canvas Image

Opened this issue · 1 comments

Hi, I've just added sketch.js on my project and it works greats!
I have only one problem: I need to store the image 'sketched' in my db but if I can to try to get it I obtain a blank image :-(
How I can do it?
With this code toDataURL is always the same and represent a blank image
....
canvas = document.getElementById('canvasDiv');
var ctx = canvas.getContext("2d");
canvas.width = '100';
canvas.height = '50';
dataPicture = canvas.toDataURL("image/png");
newPicture = dataPicture.replace('data:image/jpeg;base64,', '');
...

To start with you say that you want a png data url, yet when you parse it you treat it as if it's jpeg.