Javascript 如何从firebase存储更快地加载图像?

Javascript 如何从firebase存储更快地加载图像?,javascript,firebase,firebase-storage,Javascript,Firebase,Firebase Storage,从firebase存储加载图像的速度非常慢,在我的网页中显示图像需要2秒以上的时间。是否有任何方法可以加速图像加载?当允许读访问世界时,如:allow read:if-true,它会发芽吗 请指导我,从firebase存储上传和下载图像的最佳方式是什么?谢谢 以下是我的存储规则: service firebase.storage { match /b/test-project-faac7.appspot.com/o { match /{allPaths=**} { all

从firebase存储加载图像的速度非常慢,在我的网页中显示图像需要2秒以上的时间。是否有任何方法可以加速图像加载?当允许读访问世界时,如:
allow read:if-true
,它会发芽吗

请指导我,从firebase存储上传和下载图像的最佳方式是什么?谢谢

以下是我的存储规则:

service firebase.storage {
  match /b/test-project-faac7.appspot.com/o {
    match /{allPaths=**} {
      allow read: if request.auth != null;
      allow write: if request.auth != null;
    }
  }
}
获取下载Url的代码:

 this.storage.ref(item.imgQuestion).getDownloadURL().then(url => {
    item.imgQuestionUrl = url;
 })

您可以创建一个
云函数
,在该函数中,图像可以在
上传后进行压缩
并替换原始图像。你可以按照这个来获得一些想法。您需要监视
存储
上传以触发您的功能