2015-03-13 7 views
6

Ich habe meine Ionic App mit dem ngCordova Kamera-Plugin aufnehmen, aber ich möchte, dass die Bilder quadratisch sind. Ich brauche auch ein Overlay, das anzeigt, welcher Bereich beschnitten wird. Hier ist der Code Ich verwende:ngCordova Kamera - Nehmen Sie quadratische Bilder wie Instagram (iOS)?

$ scope.getPhoto = function() {

Camera.getPicture().then(function(imageURI) { 
    console.log(imageURI); 
    $scope.lastPhoto = imageURI; 
}, function(err) { 
    console.err(err); 
}, { 
    quality: 75, 
    targetWidth: 320, 
    targetHeight: 320, 
    saveToPhotoAlbum: false 
}); 

};

Danke für die Hilfe

+0

ich die gleiche Frage haben! – NMO

Antwort

2

Ich folgte Nic Tutorial des Raboy und verwaltet alles funktioniert mit den folgenden Einstellungen ‚AllowEdit‘ zu bekommen, & ‚target‘ ‚target‘.

Tutorial URL - https://blog.nraboy.com/2014/09/use-android-ios-camera-ionic-framework/

Wenn Sie Hilfe benötigen lassen Sie mich wissen,
Viel Glück!

-Controller JS

cameraApp.controller("cameraApp", function($scope, $cordovaCamera) { 

    $scope.takePicture = 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) { 
      $scope.imgURI = "data:image/jpeg;base64," + imageData; 
     }, function(err) { 
      // An error occured. Show a message to the user 
     }); 
    } 

}); 
+0

Perfekt. Vielen Dank –

Verwandte Themen