在离子应用程序中阅读库中的所有图像 [英] Read all images from gallery in ionic app

查看:102
本文介绍了在离子应用程序中阅读库中的所有图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在使用 $ cordovaImagePicker 插件。我手动选择图像。我的要求是显示来自移动设备的所有图像,如图库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.

推荐答案

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

这篇关于在离子应用程序中阅读库中的所有图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆