embiem / react-canvas-draw

React Component for drawing in canvas
https://embiem.github.io/react-canvas-draw/
MIT License
902 stars 315 forks source link

Changed from `crossOrigin` to `origin` field in the image object inside drawImage function due to a CORS error in some image urls #100

Closed OmriGM closed 4 years ago

OmriGM commented 4 years ago

Following issue #70 , the image.crossOrigin = "anonymous" caused a CORS error when trying to load some images (e.g https://ychef.files.bbci.co.uk/976x549/p08d422m.jpg). I changed it to: image.origin = "anonymous" which solves this problem.

All tests has passed.

jonra1993 commented 3 years ago

Hello I am using this configuration but when I am trying to get images from S3 AWS I always get Access to image: has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource., depite CORS have been configured. Do you suggest any solution?

juanEllaMD commented 3 years ago

Hi, great component by the way. I'm having the same issue as @jonra1993 . Do you know a workaround for AWS S3 images?? Regards.

juanEllaMD commented 3 years ago

Changing to image.origin = "anonymous" seams to work with AWS S3 @jonra1993

jonra1993 commented 3 years ago

Hi @juanEllaMD I was able to solve it too. image.origin = "anonymous" works correctly my problem was that I was using the same resource in another component and it was without image.origin = "anonymous", so browser cache was trying to request image without CORS.