Ionic Get image from Gallery

Hi, Im trying to pick image from Gallery and upload to Can any one help me to get image from phone Gallery using Ionic 2.

You can use the Camera plugin and set the sourceType to pull in from the users photo library, rather than using the camera itself.

1 Like

Want I use ionic-native plugin or ng-cordova camera plugin?

Ionic Native. ngCordova is for Ionic 1.


Thank you.any way im big fan of your blog. :slight_smile:

use this image picker plug-in. It uses ng-cordova . I have used this in 2 of my ionic applications.

It is very simple to get image from gallery.

First install plugin:
ionic plugin add cordova-plugin-camera

Than use this:

let options = {
    destinationType   : Camera.DestinationType.DATA_URL,
    sourceType        : Camera.PictureSourceType.PHOTOLIBRARY
    (data)  => {
      let image = "data:image/jpeg;base64," + data;
    (error) => {  },

thank you, very simple solution, no need to add image picker plugin

1 Like

Well, with that solution you can only pick one image at a time. With the image picker plugin you can select multiple images at a time. So it depends on what you need really.


@sava999 your solution works for me! thx…

how do I get it to show in an <img afterwards? using “image” as the source? or “data:image/jpeg;base64,”

this works for me as well.
And the picture layout looks better than image picker in ios.


Hi, I’m also trying to upload Image from Gallery and select and save it into Firebase. I’m able to go to Gallery and select a Pic. But I’m not able to save it in firebase. Could you please help me to upload image in to firebase from Photo library in Ionic2. Thanks

Hey if you still need help with posting the image to firebase check out my repo here:

Hi… I used ionic native camera and i can get images using only camera. could not get images from the library.
‘camera option’ cant add to the app.module.ts . ;; I am using ionic 3

where to apply this code? @sava999