look out here.
Hello, @Heenavora
plugin has not been installed it gives version mismatched error
But i got another solution and its work fine
Thanks for reply
Please share that another solution
Hello, @AravindhGopi
import { Camera, CameraOptions } from '@ionic-native/camera';
import { ImagePicker } from '@ionic-native/image-picker';
public base64Image : string;
public photos : any;
constructor(public navCtrl: NavController, public navParams: NavParams,public imagePicker: ImagePicker,public camera: Camera)
{
this.navCtrl= navCtrl;
}
ngOnInit()
{
this.photos = [];
}
takePhoto()
{
const options : CameraOptions =
{
quality: 50,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
}
this.camera.getPicture(options) .then((imageData) =>
{
this.base64Image = "data:image/jpeg;base64," + imageData;
this.photos.push(this.base64Image);
this.photos.reverse();
},
(err) =>
{
console.log(err);
});
}
openImagePicker()
{
let options =
{
maximumImagesCount: 3,
quality: 90,
outputType: 1
};
this.imagePicker.getPictures(options).then((results) =>
{
for (var i = 0; i < results.length; i++)
{
this.base64Image = "data:image/jpeg;base64," + results[i];
this.photos.push(this.base64Image);
}
}, (err) => { });
}
i didnāt get it?? what did you changed? its the same as above except options are stored in a variable!!!
bro this OpenImagePicker() function restarting the app
any suggestions??
Hello, @faroos
Recently i am also facing problem like when i pick image from gallery it throw me out of the app
but when i select only one image then it will work fine but when i select multi image at that time i faced above problem.
Hello, @faroos @cooldp007
Recently i changed base64 to to FIle Uri , because in ionic doc they mentioned (DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible),
so my suggestion to change base64 to file Uri
could you specify your android platform version , please ?
@Gurudath_putankar, your code worked for me.
Thanks.
I am using output type as 1 but havenāt provided any height and width but after providing the height and width by looking into your code it works like a charm.
i happens with me but when i checked for apps permission in mobile settings, storage permission was closed so after allowing storage permission it works for me.