-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toSVG there is no crossOrigin Anonymous #3589
Comments
is crossOrigin a property supported by image tag in svg? |
Afaik the answer is no. It has been proposed a while ago but it's not in the standard.
https://lists.w3.org/Archives/Public/www-svg/2015Mar/0139.html
On Tue, Dec 27, 2016 at 11:34 AM +0100, "Andrea Bogazzi" <[email protected]> wrote:
is crossOrigin a property supported by image tag in svg?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
So, we can't add crossOrigin Anonymous in fabric.loadSVGfromString ? |
not sure. we should do it to enable people to load svgs on canvas since canvas is the target of our loading. |
faced with that issue too. |
as a dirty hack - set image's sources to datauri before exporting canvas to svg |
hi! i have the same issue. is there a work around to this problem? |
I'm on v 1.7.11, and through chrome I get some random results. At times I have no problem loading and svg using The cors rule on the bucket are as follows
I added the
I'm not really sure what the issue is, so it's very had to debug what's causing this, for me. Any help would be appreciated. Thank you. Edit I've noticed, if the images are cached they get the |
@magbicaleman hey there. I'm having the exact same pb (2 years later ^^). did you find a solution? |
me is having the same issue too. |
Hi @asturur here is my code fabric.loadSVGFromURL(
svgURL,
function (objects, options) {
const obj = fabric.util.groupSVGElements(objects, options);
const canvasWidth = canvas?.clipPath.width;
const canvasHeight = canvas?.clipPath.height;
const targetWidth = canvasWidth / 5;
const targetHeight = canvasHeight / 5;
const scale = Math.min(targetWidth / obj.width, targetHeight / obj.height);
obj.scale(scale);
obj.set({
left: canvasWidth / 2,
top: canvasHeight / 2,
originX: 'center',
originY: 'center',
name: GRAPHIC_SVG_GROUP_NAME,
});
canvas.add(obj).renderAll();
canvas.setActiveObject(obj);
},
null,
{ crossOrigin: 'anonymous' },
); |
Which is the URL that is failing the crossOrigin check? the svgURL or the url of some image inside the svg? I see the Do you mind sharing the svg? (i agree an option for the svg itself should be there and that by default we should always set crossOrigin: 'anonymous' where possible ) |
Hi,
I add image with crossOrigin: 'Anonymous'
convert to JSON ( with JSON.stringify )
"crossOrigin":"Anonymous" exist in image array
convert to SVG ( with toSVG )
crossOrigin Anonymous not exist in svg tag
so how to add crossOrigin Anonymous in fabric.loadSVGFromString ?
The text was updated successfully, but these errors were encountered: