UNPKG

2.57 kBTypeScriptView Raw
1import { IonicNativePlugin } from '@ionic-native/core';
2export interface ImagePickerOptions {
3 /**
4 * 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)
5 */
6 maximumImagesCount?: number;
7 /**
8 * Max width to allow images to be
9 */
10 width?: number;
11 /**
12 * Max height to allow images to be
13 */
14 height?: number;
15 /**
16 * Quality of images, defaults to 100
17 */
18 quality?: number;
19 /**
20 * Videos allowed?
21 */
22 allow_video?: boolean;
23 /**
24 * the default is the message of the old plugin impl
25 */
26 title?: string;
27 /**
28 * the old plugin impl didn't have it, so passing null by default
29 */
30 message?: string;
31 /**
32 * Choose the format of the return value.
33 * Defined in ImagePicker.OutputType. Default is FILE_URI.
34 * FILE_URI : 0, Return image file URI,
35 * DATA_URL : 1, Return image as base64-encoded string
36 */
37 outputType?: number;
38 /**
39 * Disable the iOS popover as seen on iPad
40 */
41 disable_popover?: boolean;
42}
43export declare enum OutputType {
44 FILE_URL = 0,
45 DATA_URL = 1
46}
47/**
48 * @name Image Picker
49 * @description
50 * Cordova Plugin For Multiple Image Selection
51 *
52 * Requires Cordova plugin: `cordova-plugin-image-picker`.
53 * For more info, please see the https://github.com/Telerik-Verified-Plugins/ImagePicker
54 *
55 * @usage
56 * ```typescript
57 * import { ImagePicker } from '@ionic-native/image-picker/ngx';
58 *
59 *
60 * constructor(private imagePicker: ImagePicker) { }
61 *
62 * ...
63 *
64 * this.imagePicker.getPictures(options).then((results) => {
65 * for (var i = 0; i < results.length; i++) {
66 * console.log('Image URI: ' + results[i]);
67 * }
68 * }, (err) => { });
69 *
70 * ```
71 * @interfaces
72 * ImagePickerOptions
73 */
74export declare class ImagePicker extends IonicNativePlugin {
75 /**
76 * Pick pictures from the library.
77 * @param {ImagePickerOptions} options
78 * @returns {Promise<any>} Returns a Promise that resolves the image file URI
79 * otherwise rejects with an error.
80 */
81 getPictures(options: ImagePickerOptions): Promise<any>;
82 /**
83 * Check if we have permission to read images
84 * @returns {Promise<boolean>} Returns a promise that resolves with a boolean that indicates whether we have permission
85 */
86 hasReadPermission(): Promise<boolean>;
87 /**
88 * Request permission to read images
89 * @returns {Promise<any>}
90 */
91 requestReadPermission(): Promise<any>;
92}