awesome-cordova-plugins/src/plugins/imagepicker.ts

60 lines
1.6 KiB
TypeScript
Raw Normal View History

2016-07-18 01:56:02 +08:00
import { Cordova, Plugin } from './plugin';
2016-03-11 04:29:50 +08:00
export interface ImagePickerOptions {
2016-07-18 01:56:02 +08:00
// 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.
maximumImagesCount?: number;
2016-03-11 04:29:50 +08:00
2016-07-18 01:56:02 +08:00
// max width and height to allow the images to be. Will keep aspect
// ratio no matter what. So if both are 800, the returned image
// will be at most 800 pixels wide and 800 pixels tall. If the width is
// 800 and height 0 the image will be 800 pixels wide if the source
// is at least that wide.
width?: number;
height?: number;
2016-03-11 04:29:50 +08:00
2016-07-18 01:56:02 +08:00
// quality of resized image, defaults to 100
quality?: number;
2016-03-11 04:29:50 +08:00
}
/**
2016-03-14 03:45:07 +08:00
* @name Image Picker
2016-03-11 04:29:50 +08:00
* @description
* 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
*
* @usage
* ```typescript
* import { ImagePicker } from 'ionic-native';
*
*
*
2016-03-11 07:59:14 +08:00
* ImagePicker.getPictures(options).then((results) => {
2016-03-11 04:29:50 +08:00
* for (var i = 0; i < results.length; i++) {
* console.log('Image URI: ' + results[i]);
* }
* }, (err) => { });
2016-03-11 04:29:50 +08:00
* ```
*/
@Plugin({
plugin: 'cordova-plugin-image-picker',
2016-03-11 04:39:14 +08:00
pluginRef: 'window.imagePicker',
2016-03-11 04:29:50 +08:00
repo: 'https://github.com/wymsee/cordova-imagePicker'
})
export class ImagePicker {
/**
* Pick pictures from the library.
* @param {ImagePickerOptions} options
* @return Returns a Promise that resolves the image file URI
* otherwise rejects with an error.
*/
@Cordova({
callbackOrder: 'reverse'
})
static getPictures(options: ImagePickerOptions): Promise<any> { return; }
2016-07-18 01:56:02 +08:00
2016-03-11 04:29:50 +08:00
}