캡처 된 이미지를 일부 사용자 지정 편집기로 편집 한 후 Firebase 저장소에 업로드하려고합니다.FILE_URI와 이미지를 이오니아 2의 파이어베이스 스토리지에 업로드하는 방법
이가지 경우 아래 내 문제 :
사례 1 : 나는이 코드를 사용하는 경우, 내가 이미지 을 업로드 할 수 있습니다하지만 난 내 사용자 지정 편집기를 사용할 수 없습니다
takePicture(){ let options: CameraOptions; options = { quality : 85, destinationType: this.camera.DestinationType.DATA_URL, sourceType : this.camera.PictureSourceType.CAMERA, allowEdit : false, encodingType: this.camera.EncodingType.JPEG, correctOrientation: true, saveToPhotoAlbum: true } this.camera.getPicture(options).then((imageData) => { this.currentOriginalImageUri = 'data:image/jpeg;base64,' + imageData; this.currentDocumentImageUri = 'data:image/jpeg;base64,' + imageData; }); }
사례 2 :이 코드를 사용한 경우 사용자 정의 편집기 의 기능을 사용할 수 있지만 이미지를 업로드 할 수 없습니다.
,210takePicture(){ let options: CameraOptions; options = { quality : 85, destinationType: this.camera.DestinationType.FILE_URI, sourceType : this.camera.PictureSourceType.CAMERA, allowEdit : false, encodingType: this.camera.EncodingType.JPEG, correctOrientation: true, saveToPhotoAlbum: true } this.camera.getPicture(options).then((imageData) => { this.currentOriginalImageUri = imageData; this.currentDocumentImageUri = imageData; }); }
참고 :이 그래서 두 경우 모두를 사용할 수있는 방법이 내 업로드 기능
private uploadPhoto(): void {
let loader = this.loadingCtrl.create({
content: ""
})
loader.present().then(_=>{
return this.myPhotosRef.child(this.generateUUID()).child('myPhoto.JPEG').putString(this.currentDocumentImageUri,firebase.storage.StringFormat.DATA_URL).then((savedPicture) => {
this.currentDocumentImageUri = savedPicture.downloadURL;
this.afd.list('/notesImages/').push({
note_id: this.appService.id,
url: this.currentDocumentImageUri,
date: new Date().toISOString()
});
});
}).then(_=>{
loader.dismiss();
this.viewCtrl.dismiss();
})
}
입니까?
하나는 file_url이고 다른 하나는 data_url입니다. file url로 테스트하는 동안'firebase.storage.StringFormat.DATA_URL'을 변경 했습니까? –
@SurajRao 무엇으로 변경하나요? –