Fomahaut
Fomahaut

Reputation: 1212

Cordova camera doesn't rotate the pic to correct orientation on Samsung S3

    var onSuccess = function(imageUri){
        $scope.report.imgUri = imageUri;
    };

    var onError = function(message){
        alert('Failed because: ' + message);
    };

    $scope.capturePhoto = function(){
        navigator.camera.getPicture(onSuccess, onError, {
            quality: 40,
            destinationType: navigator.camera.DestinationType.FILE_URI,
            correctOrientation: true,
            saveToPhotoAlbum: true,
            encodingType: navigator.camera.EncodingType.PNG,
            targetWidth: divWidth
        });
    };

I am building Cordova 3.5.0 on Samsung S3 with Android 4.3. The camera.capturePhoto function always ignore correctOrientation set, so the pic did not rotate to correct orientation. But it works fine on HTC Butterfly with Android 4.4. BTW, encodingType not work on android either. Any idea?

Upvotes: 6

Views: 5981

Answers (1)

karma
karma

Reputation: 923

In some cases, setting navigator.camera.EncodingType.JPEG helped.

encodingType: Camera.EncodingType.JPEG,
mediaType: Camera.MediaType.PICTURE,
correctOrientation: true

Upvotes: 7

Related Questions