Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fetch all gallery image of mobile using cordova?

Tags:

I want to fetch the complete gallery of a mobile device to show them in a custom grid, is it possible? Right now I am using $cordovaImagePicker which is redirecting me to the gallery and then after selecting the image I am getting the Uri of that image. Instead of that I want the complete gallery images uri auto selected.

Controller

$scope.getImageFromGallery = function() {
    // Image picker will load images according to these settings
    var options = {
        maximumImagesCount: 1, // Max number of selected images, I'm using only one for this example
        width: 800,
        height: 800,
        quality: 80 // Higher is better
    };

    $cordovaImagePicker.getPictures(options).then(function(results) {
        // Loop through acquired images
        for (var i = 0; i < results.length; i++) {
            alert(results);
            $scope.image = results[i];
            // Print image URI
        }
    }, function(error) {
        console.log('Error: ' + JSON.stringify(error)); // In case of error
    });
}

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!