I am using phonegap and javascript to capture an image and display the image. The orientation is wrong when displayed on my android device. Having done some research I came across two JS files binaryajax.js and exif.js. I am trying to use this to change the orientation of the image by changing the EXIF data but it is not working. I get an empty string returned from pretty function in exif.js which takes an image as a parameter and displays properties of image. So I tried decoding the image and using other functions to display exif data but still it is not working, I either get undefined or false.
function captureCameraPic() {
// Take picture using device camera
var camera = navigator.camera.getPicture(onCameraPicSuccess, onCameraPicError,
{
quality: 80,
destinationType: destinationType.DATA_URL
});
}
function onCameraPicSuccess(imgData)
{
document.getElementById('tempImg').src = "data:image/jpeg;base64," + imgData;
document.getElementById('tempImg').onload = function()
{
alert(document.getElementById('tempImg').src);
var b64 = document.getElementById('tempImg').src;
var bin = window.atob(b64.split(',')[1]);
alert(b64);
var exif = EXIF.readFromBinaryFile(new BinaryFile(bin));
alert(exif.Make);
alert(EXIF.pretty(document.getElementById('tempImg')));
}