Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 534
Fomahaut Avatar asked May 27 '14 01:05

Fomahaut


1 Answers

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

encodingType: Camera.EncodingType.JPEG,
mediaType: Camera.MediaType.PICTURE,
correctOrientation: true
like image 86
karma Avatar answered Oct 06 '22 18:10

karma