Fix #18: don't upload original media by default, add new command line options

pull/21/head
Romain Prieto 10 years ago
parent c72f46e463
commit ef294ad513

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

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

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

@ -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
}),

Loading…
Cancel
Save