I have some orientation problems when using the navigator.camera.getPicture
in phonegap 2.9.
After getting the picture I'm passing it to a view for clipping.
This is the options I'm using
{
quality: 60,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: source,
encodingType: Camera.EncodingType.JPEG,
correctOrientation: true,
targetWidth: 640
}
I have tried to get the picture base64 encoded. The image does show up in correct orientation when using correctOrientation: true
.
When not setting correctOrientation: true
, image appear in correct orientation when selecting from PHOTOLIBRARY
but not from SAVEDPHOTOALBUM
.
However, using the base64 encoded image is extremely slow and heavy on my galaxy note 3 (13 mega pixels).
Getting the FILE_URI works smoother ( destinationType: Camera.DestinationType.DATA_URL
).
Works quite well from PHOTOLIBRARY
, except that I get a wierd URL in return :
content://com.google.android.apps.photos.content/0/https%3A%2F%2F ... some url to image on google
which i have to split and decode: imageURI = decodeURIComponent(imageURI.split('/')[4]);
which will probably work bad on non-android devices :)
But this seems to ignore the correctOrientation
property when selecting from SAVEDPHOTOALBUM
.
I also notice that all images on my camera (probably) are in landscape, but the phone is correcting orientation with some orientation metadata on capture, which is lost when moving the image from the device and/or when using the FILE_URI
?
How can I currect the orientation when displaying image from SAVEDPHOTOALBUM
using FILE_URI?