简体   繁体   English

在Firebase Storage中启用CORS

[英]Enabling CORS in firebase Storage

I'm developing an App using Angular 4 and Fabric.Js. 我正在使用Angular 4和Fabric.Js开发应用程序。 As a Backend, I'm using firebase. 作为后端,我正在使用Firebase。

I'm having a problem when trying to apply filters to images. 尝试将滤镜应用于图像时遇到问题。 Example provided below: 下面提供的示例:

filterTest() {
const image = this._canvas.getActiveObject();
image.filters.push(new fabric.Image.filters.Grayscale());
image.applyFilters();
this._canvas.renderAll();
}

When I try to execute the mentioned piece of code I keep getting the following error: 当我尝试执行上述代码时,我不断收到以下错误:

Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at... 无法在“ WebGLRenderingContext”上执行“ texImage2D”:跨源图像位于...

I'm saw some workarounds on the web, but no one seems to work for me. 我在网络上看到了一些解决方法,但似乎没有人适合我。

What should I do? 我该怎么办? Did anyone have the same problem? 有人遇到过同样的问题吗? Let me know if more info is needed! 让我知道是否需要更多信息!

For those who are looking for an answer for this problem: 对于那些正在寻找这个问题的答案的人:

My problem was that I was trying to load images from a JSON file using fabric.util.loadImage(), however I was not setting the last parameter to 'anonymous'! 我的问题是我试图使用fabric.util.loadImage()从JSON文件加载图像,但是我没有将最后一个参数设置为'anonymous'!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM