Ionic 1, firebase storage, cordova.getPictures, not save images?


#1

Good morning everyone
I have the following problem
sorry for my English

I’m programming an application
with ionic 1 and firebase 3

I want to upload an image to the storage of firebase

When I use html fileupload the image is saved but when i use “cordova.getPictures” the image is not saved

the code…

.controller("PhotosCtrl",function($scope,$firebaseArray,$firebaseAuth,$firebaseObject, $timeout, $cordovaImagePicker, $ionicPopup){
 
 $scope.upFile = function(){
  
    pickTheImage().then(function(_image) {
    processImage(_image);

    })

 }

 function pickTheImage() {
      var options = {
        maximumImagesCount: 1,
        width: 320,
        quality: 80
      };

      return $cordovaImagePicker.getPictures(options).then(function (results) {
           return results[0];
        })
    }

  function processImage(_image) {

     fetch(_image).then(function (_data) {
        return _data.blob()
      }).then(function (_blob) {

        var task=firebase.storage().ref('images/12312355.jpg').put(_blob);

        task.on('state_changed', 

        function progress(snapshot){
        },
        function error(err){
            $ionicPopup.alert({
            title: err
          })
        },
        function complete(){
            $ionicPopup.alert({
              title: "Imagen guardada!"
            })
        }
    );
      })
  }
})