Let's say I want to get the base64 encoded version of the cropped image. I need to use this method rather than the canvas.toBlob() approach, due to lack of IE9 compatibility for toBlob().
I first do the following:
var canvas = $("#cropper-image").cropper("getCroppedCanvas");
console.log(canvas);
Which produces (as expected):
<canvas width="319" height="319">
Now I attempt to convert to base64 using the following:
var data = canvas.toDataUrl("image/jpeg");
console.log(data);
An error is thrown:
(index):60 Uncaught TypeError: canvas.toDataUrl is not a function
at HTMLAnchorElement.<anonymous> ((index):60)
at HTMLAnchorElement.dispatch (jquery-3.2.1.min.js:3)
at HTMLAnchorElement.q.handle (jquery-3.2.1.min.js:3)
Is this a library bug, or am I doing something wrong?
Tested on v3.0.0-rc.3 with latest jquery.
Let's say I want to get the base64 encoded version of the cropped image. I need to use this method rather than the
canvas.toBlob()
approach, due to lack of IE9 compatibility fortoBlob()
.I first do the following:
Which produces (as expected):
Now I attempt to convert to base64 using the following:
An error is thrown:
Is this a library bug, or am I doing something wrong?