user2952267
user2952267

Reputation: 79

Read all images from gallery in ionic app

At present I am using $cordovaImagePicker plug-in. I am manually selecting images. My requirement is to display all images from mobile like a gallery App.

$cordovaImagePicker.getPictures(options)
    .then(function(results,afterLoop) {                
          var    arrayItems=[];
          for (var i = 0; i < results.length; i++) {
              $scope.images.push(results[i]);

          }

    }, function(error) {

});

This loads gallery images in a popup where they can be selected. I don't want any popup instead just read all images from phone automatically when page load. Can someone please guide me to the right direction.

Upvotes: 4

Views: 612

Answers (1)

Anu
Anu

Reputation: 773

$scope.selectImage = function () { 

       var options = {
           maximumImagesCount: 10, // count of images you want to select
           width: 300,
           height: 300,
           quality: 100
       }; 


       $cordovaImagePicker.getPictures(options)

           .then(function (results) {
               $scope.imageList = results;
               console.log('gallery data: ' + angular.toJson(results));
               console.log(results);
              for (var i = 0; i < results.length; i++) {
                   $scope.imageList.push(results[i]);
               }
           }, function (error) {
               console.log(error);
           });
   }

Upvotes: 3

Related Questions