jeduan / cordova-plugin-crop

Crop an image in Cordova
MIT License
114 stars 170 forks source link

I am getting very small image to crop #41

Open anjaneyulu-nyros opened 7 years ago

anjaneyulu-nyros commented 7 years ago

I getting image small image when I taken image from camera to crop. and also how to crop the image with circular. please help me.

My code is like this

    var myPopup = $ionicPopup.show({
     title: 'Upload Profile Background Image',

     buttons: [
        { 
          text: '<b><i class="icon ion-close size-25 dark"></i></b>',
          'type':'button-assertive',
            onTap: function(e)
            {
              return 0;
             }
         }, {
           text: '<b><i class="icon ion-images size-25 dark"></i></b>',
           type: 'button-positive',
            onTap: function(e)
            {

              var options = {
                               quality : 100,
                               targetWidth: 400,
                               targetHeight: 200,
                               correctOrientation: true,
                               sourceType: 0
                            };
              return options;

            }
        },
        { text: '<b><i class="icon ion-camera size-25 dark"></i></b>',
          type: 'button-positive',
          onTap: function(e)
          {

             var options = {
                             quality : 100,
                             targetWidth: 400,
                             targetHeight: 200,
                             correctOrientation: true,
                             sourceType: 1
                          };
             return options;

         }
        }
     ]
  });

  myPopup.then(function(options) {
    if(options != 0)
    {
       $cordovaCamera.getPicture(options).then(function(imageData)
       {
              var option={keepingAspectRatio : true,allowEdit: true}
            $rootScope.bgimage = imageData;
         var pbgurl = $rootScope.bgimage.split('?')[0];
         plugins.crop(function success (newPath) {
          // console.log(newPath);

           document.getElementById('bgprofile').style.backgroundImage = "url('"+newPath.split('?')[0]+"')";

          }, function fail () {

           }, pbgurl,option)

           $scope.edit=false;
           $scope.save=true;
       })
    }
  }),
  function(err)
  {
    console.log(err);
  };  
anjaneyulu-nyros commented 7 years ago

I have changed camera options. Now I am getting large image. I got another issue how can I get the image cropped or cancel action and also crop the image with circle instead square . Please help me thanks in advance