Need help upgrading to Ionic Framework 4.0? Get assistance with our Enterprise Migration Services EXPLORE NOW

Image Picker

Improve this doc

Cordova Plugin For Multiple Image Selection

Requires Cordova plugin: cordova-plugin-image-picker. For more info, please see the https://github.com/wymsee/cordova-imagePicker

Repo: https://github.com/Telerik-Verified-Plugins/ImagePicker

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-telerik-imagepicker --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="your usage message"
    $ npm install --save @ionic-native/image-picker@4
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { ImagePicker } from '@ionic-native/image-picker';


constructor(private imagePicker: ImagePicker) { }

...

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

Instance Members

getPictures(options)

Pick pictures from the library.

Param Type Details
options ImagePickerOptions

Returns: Promise<any> Returns a Promise that resolves the image file URI otherwise rejects with an error.

hasReadPermission()

Platforms:Android 

Check if we have permission to read images

Returns: Promise<boolean> Returns a promise that resolves with a boolean that indicates whether we have permission

requestReadPermission()

Platforms:Android 

Request permission to read images

Returns: Promise<any>

ImagePickerOptions

Param Type Details
maximumImagesCount number

max images to be selected, defaults to 15. If this is set to 1, upon selection of a single image, the plugin will return it. (Android only)

(optional)
width number

Max width to allow images to be

(optional)
height number

Max height to allow images to be

(optional)
quality number

Quality of images, defaults to 100

(optional)
outputType number

Choose the format of the return value. Defined in ImagePicker.OutputType. Default is FILE_URI. FILE_URI : 0, Return image file URI, DATA_URL : 1, Return image as base64-encoded string

(optional)

API

Native

General