Phonegap - Choose Image From Gallery

Viewed 57830

Can anyone tell me, or point me in the direction of how to get an image from the phone's image gallery in Phonegap / Android? There's docs on accessing the camera (which works great) but not selecting an existing image.

I'm looking for Phonegap / Javascript rather than Java.

Thanks in advance!

6 Answers

I'm working on cordova-plugin-photo-library plugin which provides cross-platform way to enumerate through all photos on device.

Usage:

cordova.plugins.photoLibrary.getLibrary(function (library) {
    // Here we have the library as array
    cordova.plugins.photoLibrary.getThumbnailUrl(library[0],
        function (thumbnailUrl) { image.src = thumbnailUrl; },
        function (err) { console.log('Error occured'); },
        {
            thumbnailWidth: 512,
            thumbnailHeight: 384,
            quality: 0.8
        });
    });

Related