Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49186

Unable to display image using plugin Camera

$
0
0

@anicacute09 wrote:

Hi guys, I am facing trouble displaying the imageUri whether it is taken from camera or gallery. Here is my code

$scope.takePhoto = function () {
        var options = {
            quality: 75,
            destinationType: Camera.DestinationType.DATA_URL,
            sourceType: Camera.PictureSourceType.CAMERA,
            allowEdit: true,
            encodingType: Camera.EncodingType.JPEG,
            targetWidth: 300,
            targetHeight: 300,
            popoverOptions: CameraPopoverOptions,
            saveToPhotoAlbum: false
        };

            $cordovaCamera.getPicture(options).then(function (imageData) {
                console.log("Success");
                $scope.picture = "data:image/jpeg;base64," + imageData;
                console.log($scope.picture);
            }, function (err) {
                console.log(err);
            });
        }

    $scope.choosePhoto = function () {
        var options = {
          quality: 75,
          destinationType: Camera.DestinationType.FILE_URI,
          sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
          allowEdit: true,
          encodingType: Camera.EncodingType.JPEG,
          targetWidth: 300,
          targetHeight: 300,
          popoverOptions: CameraPopoverOptions,
          saveToPhotoAlbum: false
      };

          $cordovaCamera.getPicture(options).then(function (imageData) {
              $scope.picture = "data:image/jpeg;base64," + imageData;
              console.log("Success");
              console.log($scope.picture);
          }, function (err) {
                console.log(err);
          });
      }

When I see my scope.picture I taking photo from gallery the result was : data:image/jpeg,base64,file:///storage/emulated/0/Android/data/com.ionicframework.ionicblankapp/cache/IMG_20161006.jpg?1475734026558

Is this strange that my image Uri has ionic.. etc tec in it?? What am I doing wrong??

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>