更新时间:2023-02-06 22:35:39
你可以在 upload
之后创建一个 cloud-function
来替换原始图像。你可以按照这个示例来得到一些想法。您需要注意存储
上传以触发您的功能。
Loading images from firebase storage is very slow, it was taking more than 2sec
to show image in my web page. Is there any way to seed up image loading? Will it seed up when give read access to world Like: allow read: if true
?
Please guide me, what is the best way to upload and download images from firebase storage? Thanks.
Following is my Storage Rule:
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;
}
}
}
Code to get Download Url :
this.storage.ref(item.imgQuestion).getDownloadURL().then(url => {
item.imgQuestionUrl = url;
})
You could create a cloud-function
where the image can be compressed after upload
and replace the original image. You can follow this sample to get some idea. You will need to watch for storage
upload to trigger your functions.