feat(metadata): add GPS lat/long

latlong
Romain 5 years ago
parent eefa5bdf33
commit dc5cf14355

@ -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]

Loading…
Cancel
Save