Building apps at a large company? Check out Ionic Enterprise

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
    
  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

Output type, defaults to 0 (FILE_URI).

(optional)

API

Native

General