If you want to select more than one images at a time in phone gap application, you can use the plugin cordova-image Picker. It allows you to select multiple images and also provides the properties for setting maximum images and changing the size or quality of the images.
Installing the plugin:
It can be installed using the following command:
cordova plugin add cordova-plugin-image-picker
Using the plugin:
This plugin creates window.imagePicker object and it provides method getPictures(success, fail, options).
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 code you can select 10 images with 800 scaled width by using the property maximumImagesCount and width. You can also set the quality(0–100) of images.
0 Comment(s)