无法获取上传到Firebase的图片的下载URL

时间:2019-10-04 03:16:00

标签: ionic3 angularfire2

我目前正在使用Firebase开发Ionic 3应用程序,并且在我的FYP中使用AngularFire。我刚刚完成了将图像上传到Firebase的工作,现在我想检索图像。但是,通过使用getDownloadURL(),我没有获得任何传递回的URL。这是我的代码:

  upload(){
this.firebaseauth.authState.take(1).subscribe(auth => {
 const ref=this.mypicref.child('images').child(`${auth.uid}`).child(this.uid())
  .putString(this.picdata,'base64', {contentType:'image/png'})
  .then(savepic => {
    this.picurl=savepic.getDownloadURL()
  });
  console.log(this.picurl);

  })

}

我一直在寻找解决方案,但没有任何效果。我是新来的,所以我不知道哪里出了问题。希望有人能帮忙。预先感谢。

0 个答案:

没有答案