0
我能够将图像保存到我的Firebase存储中,但在存储中,没有任何内容可以告诉我上传照片的用户的ID。在我的应用程序中,用户可以上传照片作为博客,尽可能多地更新每张照片应该分别具有用户的ID和博客的关键。因此,我很容易分别为每个博客获取图像。我怎样才能做到这一点?使用身份验证ID将图像存储在Firebase中 - Xamarin
这是我如何保存我的图片
public void OnClick(View v)
{
Intent intent = new Intent();
intent.SetType("image/*");
intent.SetAction(Intent.ActionPick);
StartActivityForResult(Intent.CreateChooser(intent, "Select Image"), PICK_IMAGE_REQUEST);
}
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
try{
Bitmap bitmap = MediaStore.Images.Media.GetBitmap(this.ContentResolver, data.Data);
using (MemoryStream stream = new MemoryStream())
{
bitmap.Compress(Bitmap.CompressFormat.Jpeg,100,stream);
byte[] array = stream.ToArray();
imageViewDrop.SetImageBitmap(bitmap);
}
if(data.Data != null){
pd = new ProgressDialog(this);
pd.SetTitle("Uploading");
pd.Show();
StorageReference images = storageRef.Child("images");
images.PutFile(data.Data).AddOnSuccessListener(this);
images.PutFile(data.Data).AddOnProgressListener(this);
}
else {
}
imageViewDrop.SetImageBitmap(bitmap);
}
catch (Java.Lang.Exception e){
}
}
public void OnSuccess(Java.Lang.Object result)
{
pd.Dismiss();
}
public void OnProgress(Java.Lang.Object snapshot)
{
}