I want to read the Date and Time when a Photo was taken from the exif
data of a picture.
I use this library https://github.com/exif-js/exif-js to access exif
and $cordovaCamera
to get the picture.
The $cordovaCamera
options: (I let the user decide where the picture should come from (gallery or camera) so source
can be 1 or 0:
var options = {
quality: 60,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: source,
allowEdit: false,
correctOrientation: true,
encodingType: Camera.EncodingType.JPEG,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: true
};
Getting the picture:
$cordovaCamera.getPicture(options).then(function (imageData) {
cameraSuccess(imageData);
});
And processing it:
function cameraSuccess(imageURI) {
var imageR = new Image();
imageR.onload = function() {
EXIF.getData(imageR, function() {
alert(JSON.stringify(this));
});
};
imageR.src = "data:image/jpeg;base64,"+imageURI;
}
But this is the only exif
data i get.
"exifdata":{
"Orientation":1,
"ExifIFDPointer":38,
"ColorSpace":1,
"PixelXDimension":500,
"PixelYDimension":375
},
"iptcdata":{
}
I also tried Camera.DestinationType.NATIVE_URI
to make sure that base64
is no problem.
I tested it on a ios-emulator (take image from gallery) with the above result and an android device (take image from camera) without any output.