Ionic select picture from galery


#1

Hi!
I need help, because i dont understund why dont work…, i try $cordovaImagePicker, $cordovaCamera but dont work.

<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>



<body ng-app="starter">
  <div ng-controller="ThisCtrl">
  <ion-nav-bar class="bar-energized"></ion-nav-bar>
  <ion-nav-view>
  <button class="button button-full button-positive" ng-click="selimg()">Select img</button>
  </ion-nav-view>  
  </div>
</body>

app.js

var app = angular.module('starter', ['ionic','ngCordova'])
 
app.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if(window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
});

app.controller('ThisCtrl', function($scope, $cordovaImagePicker) {

$scope.selimg = function () {
  var options = {
   maximumImagesCount: 10,
   width: 800,
   height: 800,
   quality: 80
  };

  $cordovaImagePicker.getPictures(options)
    .then(function (results) {
      for (var i = 0; i < results.length; i++) {
        console.log('Image URI: ' + results[i]);
      }
    }, function(error) {
      // error getting photos
    });
}
});

and install $cordovaImagePicker
in emulator and bluestack dont work…
thx


#2

i only used $cordovaCamera

set sourceType to Camera.PictureSourceType.PHOTOLIBRARY in the config-object.


#3

special thanks :slight_smile:
i did it yesterday