2017-05-03 3 views
1

Ich bin auf dem neuesten Stand mit dem Cordova-Kamera-Plugin, aber es funktioniert nicht die Größenänderung oder die Qualitätsänderung, versuchte ich mit JPEG und PNG aber nichts.Cordova Kamera-Plugin nicht Größe ändern

$ ionic plugin ls 
WARN: ionic.project has been renamed to ionic.config.json, please rename it. 
com-badrit-base64 0.2.0 "Base64" 
com.googlemaps.ios 2.1.1 "Google Maps SDK for iOS" 
cordova-plugin-camera 2.4.1 "Camera" 
cordova-plugin-compat 1.1.0 "Compat" 
cordova-plugin-console 1.0.3 "Console" 
cordova-plugin-device 1.1.2 "Device" 
cordova-plugin-file 4.3.1 "File" 
cordova-plugin-file-transfer 1.6.1 "File Transfer" 
cordova-plugin-geolocation 2.4.2 "Geolocation" 
cordova-plugin-googlemaps 1.4.0 "phonegap-googlemaps-plugin" 
cordova-plugin-screen-orientation 2.0.1 "Screen Orientation" 
cordova-plugin-splashscreen 3.2.2 "Splashscreen" 
cordova-plugin-statusbar 2.1.3 "StatusBar" 
cordova-plugin-whitelist 1.2.2 "Whitelist" 
es6-promise-plugin 4.1.0 "Promise" 
ionic-plugin-keyboard 2.2.1 "Keyboard" 

Und einige Code

$scope.take_picture = function() 
{ 
    screen.orientation.lock('portrait'); 
    var options = { 
     quality: 25, 
     destinationType: Camera.DestinationType.FILE_URI, 
     sourceType: Camera.PictureSourceType.CAMERA, 
     encodingType: Camera.EncodingType.PNG, 
     saveToPhotoAlbum: false, 
     correctOrientation: true, 
     allowEdit: false, 
     targetHeight: 200, 
     targetwidth: 200 
    }; 

    $cordovaCamera.getPicture(options).then(function(imageURI) { 
     $scope.image_uri = imageURI; 
     $scope.marcar_gps(); 
     $cordovaCamera.cleanup(); 
     window.plugins.Base64.encodeFile($scope.image_uri, function(base64){ 
      $scope.base64 = base64.split("data:image/png;base64,")[1] 
     }); 
    }, function(err) { 
     console.log('error ',err); 
     $cordovaCamera.cleanup(); 
     $ionicLoading.hide(); 
    }); 

    return true; 
}; 

Die Bildgröße ist ich erhalte 2448 × 3264

Jede Idee? Dank im Voraus

Antwort

0
quality: 50 

Komprimierungsqualität (0-100: 0 = niedrige Qualität & hohe Kompression, 100 = Kompresse von max Qualität). Es ändert nicht die Bildauflösung.

targetHeight: 200, 
targetwidth: 200 

Für mich ist diese Angabe nur mit JPEG-Option, und ich habe auch DestinationType.DATA_URL wenn das etwas ändert.

+0

Hallo Luka, danke für die Antwort, wie gesagt auf der Frage habe ich mit JPEG und PNG aber nichts ausprobiert. Habe auch mit data_url gearbeitet, aber das macht bei einigen Handys ein Problem. Aber noch keiner von ihnen ändert die Auflösung –

Verwandte Themen