diff --git a/README.md b/README.md index a75eaf7..483ae33 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,8 @@ And you can optionally specify: - `--title [text]` website title (default: `Photo gallery`) - `--thumb-size [pixels]` thumbnail image size (default: `120`) - `--large-size [pixels]` fullscreen image size (default: `1000`) +- `--original-photos [true|false]` to allow download of full-size photos (default: `false`) +- `--original-videos [true|false]` to allow download of full-size videos (default: `false`) - `--sort-folders [name|date]` how to sort the folders/galleries (default: `date`) - `--css [file]` styles to be applied on top of the default theme (no default) - `--google-analytics [code]` code for Google Analytics tracking (no default) @@ -79,7 +81,7 @@ And you can optionally specify: For example: ```bash -thumbsup --input "/media/photos" --output "./website" --title "My holidays" --thumb-size 200 --large-size 1500 --sort-folders date --css "./custom.css" --google-analytics "UA-999999-9" +thumbsup --input "/media/photos" --output "./website" --title "My holidays" --thumb-size 200 --large-size 1500 --full-size-photos true --sort-folders date --css "./custom.css" --google-analytics "UA-999999-9" ``` You can also save all your arguments to a `JSON` file: @@ -97,6 +99,8 @@ thumbsup --config config.json "title": "My holiday", "thumb-size": 200, "large-size": 1500, + "original-photos": true, + "original-videos": false, "sort-folders": "date", "css": "./custom.css", "google-analytics": "UA-999999-9" diff --git a/bin/thumbsup.js b/bin/thumbsup.js index 8967aa4..1a795ee 100755 --- a/bin/thumbsup.js +++ b/bin/thumbsup.js @@ -25,6 +25,14 @@ var opts = yargs description: 'Fullscreen size in pixels (height)', default: 1000 }, + 'original-photos': { + description: 'Allow download of full-size photos (true|false)', + default: false + }, + 'original-videos': { + description: 'Allow download of full-size videos (true|false)', + default: false + }, 'sort-folders': { description: 'How to sort gallery folders (name | date)', default: 'date' @@ -49,6 +57,8 @@ index.build({ title: opts['title'], thumbSize: opts['thumb-size'], largeSize: opts['large-size'], + originalPhotos: opts['original-photos'] + '' === 'true', + originalVideos: opts['original-videos'] + '' === 'true', sortFolders: opts['sort-folders'], css: opts['css'], googleAnalytics: opts['google-analytics'] diff --git a/example.json b/example.json index a3b8b2f..7aa89ff 100644 --- a/example.json +++ b/example.json @@ -4,6 +4,8 @@ "title": "Photo gallery", "thumb-size": 120, "large-size": 400, + "original-photos": true, + "original-videos": true, "sort-folders": "date", "css": null, "google-analytics": null diff --git a/src/index.js b/src/index.js index 4c1f2de..9c0ba00 100644 --- a/src/index.js +++ b/src/index.js @@ -17,7 +17,11 @@ exports.build = function(opts) { function buildStep(options) { return function(callback) { - make.exec(opts.input, media, meta, options, callback); + if (options.condition !== false) { + make.exec(opts.input, media, meta, options, callback); + } else { + callback(); + } } } @@ -31,8 +35,17 @@ exports.build = function(opts) { }, buildStep({ - message: 'Original media', - ext: 'jpg|jpeg|png|mp4|mov|mts', + condition: opts.originalPhotos, + message: 'Original photos', + ext: 'jpg|jpeg|png', + dest: '/original/$path/$name.$ext', + func: fs.copy + }), + + buildStep({ + condition: opts.originalVideos, + message: 'Original videos', + ext: 'mp4|mov|mts', dest: '/original/$path/$name.$ext', func: fs.copy }),