'How to read geo location from an image file data in Javascript
How to read geolocation data from an image file (JPG, JPEG, PNG, etc) in Javascript at the moment of loading the file onto web browser but before the actual upload (on the client side).
Solution 1:[1]
There is a module called exif
you could use like this:
var ExifImage = require('exif').ExifImage;
try {
new ExifImage({ image : 'myImage.jpg' }, function (error, exifData) {
if (error)
console.log('Error: '+error.message);
else
console.log(exifData); // Do something with your data!
});
} catch (error) {
console.log('Error: ' + error.message);
}
You can use Browserify to convert this npm module for use in the browser.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | BuZZ-dEE |