0
我想上传使用科尔多瓦 - 插件摄像头,但没有成功照片火力存储:火力地堡3 +离子2 +科尔多瓦 - 插件相机 - 上传文件
这里是我的代码:
let options:any = {
quality : 100,
destinationType : Camera.DestinationType.DATA_URL,
sourceType : Camera.PictureSourceType.CAMERA,
allowEdit : false,
encodingType: Camera.EncodingType.JPEG,
mediaType: Camera.MediaType.PICTURE,
targetWidth: 1920,
targetHeight: 1920,
saveToPhotoAlbum: true,
cameraDirection: Camera.Direction.FRONT
};
Camera.getPicture(this.options).then((imageData) => {
let blob: any = new Blob([imageData], { type: "image/jpeg" });
blob.name = 'image.jpg';
let storageRef: any = firebase.storage().ref();
let path: string = 'images/' + this.user.uid + '/' + Math.random().toString(36).substr(2, 9) + '.jpg';
console.log(path);
let uploadTask: any = storageRef.child(path).put(blob);
uploadTask.on('state_changed', function(snapshot) {
console.log(snapshot);
}, function(error) {
this.showAlert(error);
}, function() {
var downloadURL = uploadTask.snapshot.downloadURL;
console.log(downloadURL);
console.log(this.user);
this.user.set({photo: downloadURL});
});
}, (err) => {
this.showAlert(err);
});
我不知道为什么,但它似乎上传,当我检查文件是空的。
任何帮助,请?
谢谢。