Hello Readers,
We can choose image through Cordova camera plugin but with this plugin we can only select one image at a time.
Now, Cordova image picker plugin helps to select more than one image at a time i.e user can select multiple image at a time.
This plugin supports iOS and Android 4.0 and above.
We need to install the plugin through CLI:
$ cordova plugin add cordova-plugin-image-picker
Usage:
This plugin creates the window.imagePicker object with getPictures method. Here is the full example:
window.imagePicker.getPictures(
function(results) {
for (var i = 0; i < results.length; i++) {
console.log('Image URI: ' + results[i]);
}
}, function (error) {
console.log('Error: ' + error);
}, {
maximumImagesCount: 10,
width: 800
}
);
In the above example getPictures method has success, fail, options parameters. In options we can define following properties :
- maximumImagesCount : It will define how much images select at a time and should be in int format. The default number is 15, so user can select 15 images at a time.
- Width and height : We can specify the with and height of the images. By default in will 800 and in to int format.
Hope this will help you to choose multiple images at a time... :)
0 Comment(s)