diff --git a/src/model/metadata.js b/src/model/metadata.js index ae22a80..ed483cd 100644 --- a/src/model/metadata.js +++ b/src/model/metadata.js @@ -33,10 +33,11 @@ class Metadata { const size = dimensions(exiftool) this.width = size.width this.height = size.height + this.lat = tagValueFloat(exiftool, 'Composite', 'GPSLatitude') + this.long = tagValueFloat(exiftool, 'Composite', 'GPSLongitude') + // include the whole Exiftool output for more flexibility this.exif = opts ? (opts.embedExif ? exiftool.EXIF : undefined) : undefined // metadata could also include fields like - // - lat = 51.5 - // - long = 0.12 // - country = "England" // - city = "London" // - aperture = 1.8 @@ -121,6 +122,11 @@ function tagValue (exif, type, name) { return exif[type][name] } +function tagValueFloat (exif, type, name) { + const val = tagValue(exif, type, name) + return val ? parseFloat(val) : val +} + function picasaValue (picasa, name) { if (typeof picasa !== 'object') return null return picasa[name]