I want to save the image into the gallery that is taken from a mobile camera and should return the stored image path. I am using angular4/ionic4
take(form: NgForm) {
this.ishide = true;
this.hide_input = false;
const options: CameraOptions = {
quality: 70,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
// saveToPhotoAlbum: true
};
this.camera.getPicture(options).then(
imageData => {
// imageData is either a base64 encoded string or a file URI
// If it's base64:
const x = null;
this.myphoto = imageData;
// localStorage.setItem('profile_picture', this.myphoto);
this.ProfilePicture = this.myphoto;
console.log(this.myphoto);
// this.presentToast(this.myphoto);
this.profileService.postInfluencerProfile(imageData, x, x).subscribe(
response => {
console.log(response);
},
(error: MavinError) => {
if (error instanceof NotFoundError) {
alert('Not found');
} else {
console.log(error);
}
}
);
},
err => {
// Handle error
}
);
}