How to pick(choose) multiple images using camera API at the same time in phonegap?

android, cordova, javascript, jquery-mobile

Solution

Use this Cordova multiple image selector plugin to choose multiple image at a time. It is good plugin for choose multiple images.

Download the above `plugin and copy paste the java classes`. Set the required `permission`. Don't forget to copy the `res folder` just copy and paste in your res folder.

Inside `assets/www` create imagepicker.js copy and paste the dowloaded imagepicker.js

In your `index.html` set like this:

<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="imagepicker.js"></script>

<script type="text/javascript">

    document.addEventListener("deviceready",onDeviceReady,false);

    function onDeviceReady(){

        window.imagePicker.getPictures(
                function(results) {
                    for (var i = 0; i < results.length; i++) {
                        alert('Image URI: ' + results[i]);

// read file type and size and file name like below(in comment)

/* window.resolveLocalFileSystemURI(results[i], function(fileEntry){
        fileEntry.file(function(fileObj) { 
            alert(fileEntry.name);
            alert(fileObj.size);
            alert(fileObj.type);
        }); 

    }, function (error) {
            alert('Error: ' + error);
        });*/
                    }
                }, function (error) {
                    alert('Error: ' + error);
                }
            );

    }
    </script>

`Note: This should work only cordova 3.0 and above and android 4.0 and above`

Problem

How to choose or pick multiple images at the same time in `phonegap camera API` when using `Camera.DestinationType.FILE_URI.` I am able to pick only one images at a time. I am able to pick multiple files(including txt,pdf..) in sdcard using this. So i want same like for images. ``` navigator.camera.getPicture(function(imageData) { window.resolveLocalFileSystemURI(imageData, function(fileEntry) { fileEntry.file(function(fileObj) { }, onFail, { quality : 50, destinationType : Camera.DestinationType.FILE_URI }); ``` My cordova version 3.3, Jquery Mobile 1.3.2. Please suggest any plugins are available to do this.

Original source