I am trying with image picker plugin to take some photos from phone library, the issue is that I cannot take the exif data, I want to take the latitude and longitude
I am using the below plugin and library https://ionicframework.com/docs/native/image-picker
import * as exif from 'exif-js';
...
takePhoto(sourceType:number) {
this.options = {
width: 200,
height: 200,
// quality of resized image, defaults to 100
//quality: 25,
// output type, defaults to FILE_URIs.
// available options are
// window.imagePicker.OutputType.FILE_URI (0) or
// window.imagePicker.OutputType.BASE64_STRING (1)
outputType: 1,
};
this.imageResponse = [];
this.imagePicker.getPictures(this.options).then((results) => {
for (var i = 0; i < results.length; i++) {
this.imageResponse.push('data:image/jpeg;base64,' + results[i]);
console.log('Image URI: ' + results[i]);
}
}, (err) => { });
}
metaData: any; // Should probably create an interface or something.
async loaded(e) {
this.metaData = await this.getGpsData(e.target);
}
getGpsData(image): Promise<any> {
return new Promise((resolve, reject) => {
exif.getData(image, function () {
var allMetaData = exif.getTag(this,"GPSLongitude");
console.log(allMetaData,"alo");
resolve(allMetaData);
});
});
}```