How to change an Images Cross Origin attribute using loadFromJSON?

自作多情 提交于 2019-12-24 10:44:35

问题


I am using FabricJS' loadFromJSON method to load a bunch of objects (text and images) to a canvas.

The images are coming from Google Cloud Storage. The bucket they are stored in has the correct CORS settings, for allow all for "Access-Control-Allow-Origin".

The images will load in OK, but when trying to save a thumbnail, using the toDataURL() method, I get:

Uncaught SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.

I'm unsure why, because the images CORS settings are correct.

I know some people suggest creating a new image and setting the attribute that way, but that doesn't fit in with using the very quick and easy loadFromJSON method.

Any ideas on why the CORS settings are being ignored and anyway around this issue?

来源:https://stackoverflow.com/questions/28815347/how-to-change-an-images-cross-origin-attribute-using-loadfromjson

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!