How to set cross-Origin in SetBackgroundImage of fabric js
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am trying to fetch an image from amazon s3 bucket.
I have configured my bucket with CORs header.
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<MaxAgeSeconds>2592000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
My canvas background image is setting like This :
canvas.setBackgroundImage(ImageURL, function () {canvas.renderAll();},
{
top: top,
left: left,
scaleX: scaleFactor,
scaleY: scaleFactor,
crossOrigin: 'anonymous'
});
It works in chrome and Mozilla in windows but not work in Safari on Mac.
I don't understand, where I am wrong.
Please correct me.
cross-domain fabricjs
add a comment |
I am trying to fetch an image from amazon s3 bucket.
I have configured my bucket with CORs header.
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<MaxAgeSeconds>2592000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
My canvas background image is setting like This :
canvas.setBackgroundImage(ImageURL, function () {canvas.renderAll();},
{
top: top,
left: left,
scaleX: scaleFactor,
scaleY: scaleFactor,
crossOrigin: 'anonymous'
});
It works in chrome and Mozilla in windows but not work in Safari on Mac.
I don't understand, where I am wrong.
Please correct me.
cross-domain fabricjs
1
I have the same issue, I'm using fabricJS 1.7.22. I'm getting same error while loading image from s3.
– Umesh Patadiya
Dec 26 '18 at 4:27
Which version of fabric are you using ?
– Pierre Olivier Tran
Jan 2 at 16:39
I am using fabric js version 1.7.22,
– mayur kukadiya
Jan 4 at 2:51
I have got solution, it's working now, Solution : I was sending two request for same image , one for get image height and width and second request for load image into canvas, in first request it was not set cross origin, and second request is send from caching which is without cross origin, and it was throw an error.
– mayur kukadiya
Jan 4 at 2:55
add a comment |
I am trying to fetch an image from amazon s3 bucket.
I have configured my bucket with CORs header.
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<MaxAgeSeconds>2592000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
My canvas background image is setting like This :
canvas.setBackgroundImage(ImageURL, function () {canvas.renderAll();},
{
top: top,
left: left,
scaleX: scaleFactor,
scaleY: scaleFactor,
crossOrigin: 'anonymous'
});
It works in chrome and Mozilla in windows but not work in Safari on Mac.
I don't understand, where I am wrong.
Please correct me.
cross-domain fabricjs
I am trying to fetch an image from amazon s3 bucket.
I have configured my bucket with CORs header.
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<MaxAgeSeconds>2592000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
My canvas background image is setting like This :
canvas.setBackgroundImage(ImageURL, function () {canvas.renderAll();},
{
top: top,
left: left,
scaleX: scaleFactor,
scaleY: scaleFactor,
crossOrigin: 'anonymous'
});
It works in chrome and Mozilla in windows but not work in Safari on Mac.
I don't understand, where I am wrong.
Please correct me.
cross-domain fabricjs
cross-domain fabricjs
edited Dec 26 '18 at 7:07
Durga
10.3k21234
10.3k21234
asked Dec 26 '18 at 4:22
mayur kukadiyamayur kukadiya
400116
400116
1
I have the same issue, I'm using fabricJS 1.7.22. I'm getting same error while loading image from s3.
– Umesh Patadiya
Dec 26 '18 at 4:27
Which version of fabric are you using ?
– Pierre Olivier Tran
Jan 2 at 16:39
I am using fabric js version 1.7.22,
– mayur kukadiya
Jan 4 at 2:51
I have got solution, it's working now, Solution : I was sending two request for same image , one for get image height and width and second request for load image into canvas, in first request it was not set cross origin, and second request is send from caching which is without cross origin, and it was throw an error.
– mayur kukadiya
Jan 4 at 2:55
add a comment |
1
I have the same issue, I'm using fabricJS 1.7.22. I'm getting same error while loading image from s3.
– Umesh Patadiya
Dec 26 '18 at 4:27
Which version of fabric are you using ?
– Pierre Olivier Tran
Jan 2 at 16:39
I am using fabric js version 1.7.22,
– mayur kukadiya
Jan 4 at 2:51
I have got solution, it's working now, Solution : I was sending two request for same image , one for get image height and width and second request for load image into canvas, in first request it was not set cross origin, and second request is send from caching which is without cross origin, and it was throw an error.
– mayur kukadiya
Jan 4 at 2:55
1
1
I have the same issue, I'm using fabricJS 1.7.22. I'm getting same error while loading image from s3.
– Umesh Patadiya
Dec 26 '18 at 4:27
I have the same issue, I'm using fabricJS 1.7.22. I'm getting same error while loading image from s3.
– Umesh Patadiya
Dec 26 '18 at 4:27
Which version of fabric are you using ?
– Pierre Olivier Tran
Jan 2 at 16:39
Which version of fabric are you using ?
– Pierre Olivier Tran
Jan 2 at 16:39
I am using fabric js version 1.7.22,
– mayur kukadiya
Jan 4 at 2:51
I am using fabric js version 1.7.22,
– mayur kukadiya
Jan 4 at 2:51
I have got solution, it's working now, Solution : I was sending two request for same image , one for get image height and width and second request for load image into canvas, in first request it was not set cross origin, and second request is send from caching which is without cross origin, and it was throw an error.
– mayur kukadiya
Jan 4 at 2:55
I have got solution, it's working now, Solution : I was sending two request for same image , one for get image height and width and second request for load image into canvas, in first request it was not set cross origin, and second request is send from caching which is without cross origin, and it was throw an error.
– mayur kukadiya
Jan 4 at 2:55
add a comment |
1 Answer
1
active
oldest
votes
I already added a comment but still, this issue looks like this.
and a solution is to set cross-origin in the first request also.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53927384%2fhow-to-set-cross-origin-in-setbackgroundimage-of-fabric-js%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I already added a comment but still, this issue looks like this.
and a solution is to set cross-origin in the first request also.
add a comment |
I already added a comment but still, this issue looks like this.
and a solution is to set cross-origin in the first request also.
add a comment |
I already added a comment but still, this issue looks like this.
and a solution is to set cross-origin in the first request also.
I already added a comment but still, this issue looks like this.
and a solution is to set cross-origin in the first request also.
answered Jan 4 at 3:03
mayur kukadiyamayur kukadiya
400116
400116
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53927384%2fhow-to-set-cross-origin-in-setbackgroundimage-of-fabric-js%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I have the same issue, I'm using fabricJS 1.7.22. I'm getting same error while loading image from s3.
– Umesh Patadiya
Dec 26 '18 at 4:27
Which version of fabric are you using ?
– Pierre Olivier Tran
Jan 2 at 16:39
I am using fabric js version 1.7.22,
– mayur kukadiya
Jan 4 at 2:51
I have got solution, it's working now, Solution : I was sending two request for same image , one for get image height and width and second request for load image into canvas, in first request it was not set cross origin, and second request is send from caching which is without cross origin, and it was throw an error.
– mayur kukadiya
Jan 4 at 2:55