Trying take a picture and upload it to firebase storage.
Here is my code;
import { Camera, CameraOptions } from '@ionic-native/camera';
async takePhoto() {
try{
const options: CameraOptions = {
quality: 50,
targetHeight: 600,
targetWidth: 600,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
}
const result = await this.camera.getPicture(options);
const image= `data:image/jpeg;based64,${result}`;
const pictures=storage().ref(`ProfilePictures/${this.myUid}`);
pictures.putString(image, `data_url`);
}
catch(e) {
console.error(e);
}
}
But it uploads a file that is not image actually. And it uploads a corrupted file even if I download it, I can't open it because its not an image.
Here is my firebase storage
thanks for reading please assist me
