scaleflex / filerobot-image-editor

Edit, resize, and filter any image! Any questions or issues, please report to https://github.com/scaleflex/filerobot-image-editor/issues
MIT License
1.27k stars 322 forks source link

CORS error when loading images from external urls #406

Open parth-pindiwala-us opened 8 months ago

parth-pindiwala-us commented 8 months ago

I am still facing the issue.

Screenshot from 2023-09-07 18-37-24

If I use noCrossOrigin then the image is loaded but I get this error. Konva error: Unable to apply filter. Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data. This post may help you https://konvajs.org/docs/posts/Tainted_Canvas.html.

As there already one issue is register but it is closed below is issue link. https://github.com/scaleflex/filerobot-image-editor/issues/319

AhmeeedMostafa commented 7 months ago

Hello @parth-pindiwala-us , as mentioned in the same Issue #319,

it is not advisable to use noCrossOrigin cause it might cause such an error u receive in some cases, so it is recommended for you to set the cross-origin policy on your server and avoid using noCrossOrigin property

also, another option that might work (not sure) is to load the image from ur side and provide it as an HTML element (as mentioned in this comment https://github.com/scaleflex/filerobot-image-editor/issues/319#issuecomment-1570220499 or provide your own BLOB URL.