Hi!
I'm trying to get a base64 of an image and use in uploadBinaryHelper with the code bellow.
code//Get img component. You should replace "mobileimage_1" with your img component name.
var img = Apperyio('item_img_61');
img.attr('crossOrigin', 'anonymous');
var width = img.width();
var height = img.height();
var canvas = jQuery('<canvas width="' + width + '" height="' + height + '"></canvas>');
var c = canvas[0];
var ctx = c.getContext("2d");
ctx.drawImage(img[0], 0, 0, width, height);
//Get base64String.
var base64String = c.toDataURL();
//var base64String = "data:image/png;base64," + c.toDataURL();
//Using base64String.
console.log(base64String);
alert(base64String);
uploadBinaryHelper(webUploadCheckin, base64String);
/code
But occoured the follow error:
codeUncaught SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported./code
Could you help me?