I'm trying to make a tshirt customizer with FabricJs.
But everytime i try to convert the canvas to Base64
$('#frontCanvas')[0].value = $('canvas')[0].toDataURL("image/png")
I get this error:
SecurityError: The operation is insecure.
I`m sure is about crossOrigin but i have no idea on how to add it to my script.
I tryed a lot, different methods, but with no success.
Any help will be apreciated.
Thank,you!
$scope.loadImage = function (source) {
var opacity = (function (min, max) {
return Math.random() * (max - min) + min;
})(0.5, 1);
fabric.Image.fromURL(source, function (image) {
image.set({
left: 100,
top: 100,
angle: 0,
padding: 10,
cornersize: 10,
hasRotatingPoint: true
});
//image.scale(getRandomNum(0.1, 0.25)).setCoords();
canvas.add(image);
});
};