Javascript Firebase上载未获取下载URL
我正在开发一个函数,在这个函数中,我将从emulator上传图像,并将其发送到firebase存储。我想获取下载URL并将其放入firebase firestore,但我没有检索下载URL。如蒙帮助,我将不胜感激。。非常感谢。 我目前正在使用firebase存储和firestore,ionic v5进行我的项目Javascript Firebase上载未获取下载URL,javascript,firebase,ionic-framework,firebase-storage,Javascript,Firebase,Ionic Framework,Firebase Storage,我正在开发一个函数,在这个函数中,我将从emulator上传图像,并将其发送到firebase存储。我想获取下载URL并将其放入firebase firestore,但我没有检索下载URL。如蒙帮助,我将不胜感激。。非常感谢。 我目前正在使用firebase存储和firestore,ionic v5进行我的项目 uploadToStorage(){ let options: CameraOptions ={ quality : 100, destinationType:thi
uploadToStorage(){
let options: CameraOptions ={
quality : 100,
destinationType:this.camera.DestinationType.DATA_URL,
encodingType : this.camera.EncodingType.JPEG,
sourceType : this.camera.PictureSourceType.PHOTOLIBRARY
}
this.camera.getPicture(options).then((data)=>{
var storage = this.store.ref('/AAA');
var photoRef = storage.child(this.mAuth.auth.currentUser.uid);
let base64img = 'data:image/jpeg;base64' + data;
var message = data;
photoRef.putString(message , 'base64', { contentType: 'image/jpg' }).then((savedPicture) => {
savedPicture.downloadURL().subscribe((datas)=>{
console.log(datas)
})
});
});
}
请编辑问题,以准确解释此代码在您运行时实际执行的操作与您预期的不同。添加更多日志以跟踪其行为。
savedPicture.snapshot.ref.downloadURL().then((datas)=>{
console.log(datas)
})