Read all images from gallery in ionic app

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-21 19:24:20

问题


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.


回答1:


$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);
           });
   }


来源:https://stackoverflow.com/questions/35357588/read-all-images-from-gallery-in-ionic-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!