简体   繁体   English

如何检索 Firebase 存储中的一个特定图像?

[英]How to retrieve a one specific image in Firebase Storage?

For example there are 10 folders in a storage and each folder have 5 images.例如,一个存储中有 10 个文件夹,每个文件夹有 5 张图像。 How do I retrieve one specific image from each folder in a loop?如何在循环中从每个文件夹中检索一个特定图像? or any methods.或任何方法。

Nevermind I got it.没关系,我明白了。

I don't know if this is right but i just named the images some incrementing numbers using loop and retrieve the first one by calling "0".我不知道这是否正确,但我只是使用循环将图像命名为一些递增的数字,并通过调用“0”来检索第一个。

But please if you have any suggestions, I would be glad.但是,如果您有任何建议,我会很高兴。

Currently, there is no way to list all files in a folder in the Firebase Storage.目前,无法列出 Firebase 存储中文件夹中的所有文件。 If you need such a functionality, you will have to store the metadata of the files (such as the download URLs) where you can list them.如果您需要这样的功能,则必须将文件的元数据(例如下载 URL)存储在可以列出它们的位置。 I think Firebase Realtime Database is good to use.我认为 Firebase 实时数据库很好用。

add image name to the other place and fetch from it将图像名称添加到另一个地方并从中获取

and get Url like并得到 Url 喜欢

myStorageRef.child("<folderNameInStorage>/" + <imageName>).getDownloadUrl().addOnSuccessListener();

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

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