Ionic Image Picker

Hi All,

I’m using Ionic 3 and I’m trying to get picture using Image Picker. I want result image with base64 type. So I used " outputType:1 " from ImagePickerOption. But when I use it, it can’t output base64 type. Is there another way to output base64 type??

You can use Camera Plugin, set the Camera Options:

public cameraOptions: CameraOptions = {
        sourceType         :,
        destinationType    :,
        encodingType       :,

and use the method getPicture( ): => {
     let image = 'data:image/jpeg;base64,' + imageData;
     return image;

That works for me :slight_smile:

You need to provide options object like this getPictures(options)

this.imagePicker.getPictures(options).then((results) => {
  for (var i = 0; i < results.length; i++) {
      console.log('Image URI: ' + results[i]);
}, (err) => { });

Snippet taken directly from official docs and it works for me every time,
Plus you need to prefix data received like this

'data:image/jpeg;base64,' + imageData
1 Like

Yes.Thanks you.But if I use it, I can’t select multiple images. Can u select multiple images using with cameraOptions??

No, I think it is not possible with that plugin…

Yeah.Any way thanks for help. :smiley:

1 Like

Yeah. I already tried with that. It’s not work for me. Thanks.

Is there any way to filter image file type. I only want to accept .jpg.

You can look for info here:

encodingType :,

all pictures selected will return in JPG type.

Aww. Oki. Thank you!!

I’m sorry I was studying the code and the plugin options accept the title and message parameters. But the ImagePickerOptions object (native index.ts) still does not support it, this does not allow the component to be multi-language.
Any solution?