Hello! I’m trying to take or get a picture from library and get the picture’s exif tags. Has anyone done that? I only tried with exif-js, but when I call
The only problem is…I have the problem to expose allMetaData outside of the exif.getData . Like for example if I want to show var allMetadata on html, it somehow doesn’t display anything
something about typescript and JS variable that i need to keep in mind of…any ideas
You’re challenging my memory here. I had to go look up how I really use this in a production app. I wrap the exif call in a promise and call that function from my event handler, binding the return value to a class-level variable. This snippet from my class definition should get you closer to what you need.
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.getAllTags(this);
console.log(allMetaData);
resolve(allMetaData);
});
});
}
Thanks WalkingRiver. It does work very well. I feel like this need to be shared to more folks so that people that want to implement exif parse in ionic 3 can refer to this
I have used "cordova-plugin-camera-with-exif": "^1.2.4", to pick images from the cameraroll with Exif data attached. The problem with exif-js is that the cordova-plugin-camera strips all the good stuff from Exif and only returns a JPEG with handful of values.
Hi. I will have runtime error when I try this error. I try adding this as the provider it will get cant resolve all parameters for EXIF. Is there anything I missed? Thanks.