Change metadata to only have exif when needed, rename exif flag

pull/133/head
Andrew McOlash 6 years ago
parent b14a255bc5
commit cbbb067957

@ -98,7 +98,7 @@ Output options:
--gm-args Custom image processing arguments for GraphicsMagick [array]
--watermark Path to a transparent PNG to be overlaid on all images [string]
--watermark-position Position of the watermark [choices: "Repeat", "Center", "NorthWest", "North", "NorthEast", "West", "East", "SouthWest", "South", "SouthEast"]
--preserve-exif Preserve the exif metadata for each image [boolean] [default: false]
--embed-exif Embed exif metadata for each image into the gallery page (enable to use exif plugin) [boolean] [default: false]
Album options:
--albums-from How files are grouped into albums [array] [default: ["%path"]]

@ -91,9 +91,9 @@ const OPTIONS = {
'West', 'East', 'SouthWest', 'South', 'SouthEast'
]
},
'preserve-exif': {
'embed-exif': {
group: 'Output options:',
description: 'Preserve the exif metadata for each image',
description: 'Embed the exif metadata for each image into the gallery page',
type: 'boolean',
'default': false
},
@ -306,7 +306,7 @@ exports.get = (args) => {
gmArgs: opts['gm-args'],
watermark: opts['watermark'],
watermarkPosition: opts['watermark-position'],
preserveExif: opts['preserve-exif']
embedExif: opts['embed-exif']
}
}

@ -21,7 +21,7 @@ const FILENAME_DATE_REGEX = /\d{4}[_\-.\s]?(\d{2}[_\-.\s]?){5}\..{3,4}/
const FILENAME_DATE_FORMAT = 'YYYYMMDD HHmmss'
class Metadata {
constructor (exiftool, picasa) {
constructor (exiftool, picasa, opts) {
// standardise metadata
this.date = getDate(exiftool)
this.caption = caption(exiftool)
@ -30,7 +30,7 @@ class Metadata {
this.animated = animated(exiftool)
this.rating = rating(exiftool)
this.favourite = favourite(picasa)
this.exif = exiftool.EXIF
this.exif = opts.embedExif ? exiftool.EXIF : undefined
// metadata could also include fields like
// - lat = 51.5
// - long = 0.12

@ -39,7 +39,7 @@ exports.run = function (opts, callback) {
// emitted for every file once indexing is finished
emitter.on('file', file => {
const picasa = picasaReader.file(file.metadata.SourceFile)
const meta = new Metadata(file.metadata, picasa || {})
const meta = new Metadata(file.metadata, picasa || {}, opts)
const model = new File(file.metadata, meta, opts)
// only include valid photos and videos (i.e. exiftool recognised the format)
if (model.type !== 'unknown') {

@ -26,9 +26,9 @@
data-download-url="{{relative urls.download}}"
data-filename="{{filename}}"
data-datetimeoriginal="{{meta.exif.DateTimeOriginal}}"
{{#if preserveExif}}
{{#if meta.exif}}
data-datetimeoriginal="{{meta.exif.DateTimeOriginal}}"
data-fnumber="{{meta.exif.FNumber}}"
data-exposuretime="{{meta.exif.ExposureTime}}"
data-isospeedratings="{{meta.exif.ISO}}"

@ -37,8 +37,7 @@ function galleryModel (rootAlbum, opts) {
footer: opts.footer,
thumbSize: opts.thumbSize,
largeSize: opts.largeSize,
googleAnalytics: opts.googleAnalytics,
preserveExif: opts.preserveExif
googleAnalytics: opts.googleAnalytics
}
}

Loading…
Cancel
Save