如何从特定用户获取Firebase中的所有图片网址 [英] How to get all images URLs from Firebase for a particular user

查看:135
本文介绍了如何从特定用户获取Firebase中的所有图片网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我上传图片的代码。

  public void uploadImage( byte [] data,final String fileName){
mProgressDialog.setMessage(上传图片....);
mProgressDialog.show();

StorageReference filepath = mStorageRef.child(Photos)。child(fileName);
filepath.putBytes(data).addOnSuccessListener(new OnSuccessListener< UploadTask.TaskSnapshot>(){
$ b @Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot){
mProgressDialog.dismiss();
String mUrl = taskSnapshot.getDownloadUrl()。toString();

//获得了这个图片的URL如何处理这个网址.....
Toast.makeText(MainActivity1.this,Upload done!,Toast.LENGTH_LONG).show();
}

});
}

我想获取为特定用户存储的所有图片url。 >

解决方案

在客户端没有列出Firebase存储项目的API。

<您应该修改您的文件上传方法,以将该下载网址存储在用户控制的某处,例如实时数据库中的用户特定路径。


I am adding images for all user in storage section, below is my code for uploading images.

public void uploadImage(byte[] data, final String fileName) {
    mProgressDialog.setMessage("Uploading image....");
    mProgressDialog.show();

    StorageReference filepath=mStorageRef.child("Photos").child(fileName);
    filepath.putBytes(data).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {

        @Override
        public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
            mProgressDialog.dismiss();
            String mUrl=taskSnapshot.getDownloadUrl().toString();

            // got url for this image what to do with this url.....
            Toast.makeText(MainActivity1.this,"Upload done!",Toast.LENGTH_LONG).show();
        }

    });
}

I want to obtain all images url stored for a particular user.

解决方案

There is no API for listing items of Firebase Storage on the client side.

You should modify your file upload method to also store that download URL somewhere in the user's control, like a user-specific path in the Realtime Database.

这篇关于如何从特定用户获取Firebase中的所有图片网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆