【发布时间】:2020-12-05 01:27:53
【问题描述】:
我正在开发一个功能,我将从模拟器上传图像并发送到 Firebase 存储。我想获取 downloadURL 并将其放入 firebase firestore,但是我没有检索下载 URL。将不胜感激帮助..谢谢! 我目前正在使用 firebase 存储和 firestore,ionic v5 进行我的项目。
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)
})
});
});
}
【问题讨论】:
-
请编辑问题以准确解释此代码在运行时实际执行的操作与您的预期不同。添加更多日志记录以跟踪其行为。
标签: javascript firebase ionic-framework firebase-storage