diff --git a/README.md b/README.md index 0fe53ea..5ed6673 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ Input options: Output options: --thumb-size Pixel size of the square thumbnails [number] [default: 120] + --small-size Pixel height of the small photos [number] [default: 300] --large-size Pixel height of the fullscreen photos [number] [default: 1000] --photo-quality Quality of the resized/converted photos [number] [default: 90] --video-quality Quality of the converted video (percent) [number] [default: 75] diff --git a/bin/options.js b/bin/options.js index bfb4691..72a50a2 100644 --- a/bin/options.js +++ b/bin/options.js @@ -67,6 +67,12 @@ const OPTIONS = { type: 'number', 'default': 120 }, + 'small-size': { + group: 'Output options:', + description: 'Pixel height of the small photos', + type: 'number', + 'default': 300 + }, 'large-size': { group: 'Output options:', description: 'Pixel height of the fullscreen photos', diff --git a/src/steps/actions.js b/src/steps/actions.js index bdedc2c..5e895d1 100644 --- a/src/steps/actions.js +++ b/src/steps/actions.js @@ -3,7 +3,7 @@ const fs = require('fs-extra') exports.createMap = function (opts) { const thumbSize = opts.thumbSize || 120 - const smallSize = 300 + const smallSize = opts.smallSize || 300 const largeSize = opts.largeSize || 1000 const defaultOptions = { quality: opts.photoQuality, diff --git a/test/steps/actions.spec.js b/test/steps/actions.spec.js index 076e3c1..801f60d 100644 --- a/test/steps/actions.spec.js +++ b/test/steps/actions.spec.js @@ -74,6 +74,17 @@ describe('actions', () => { }) }) + it('photo:small = creates a small image', testEnd => { + const map = actions.createMap({ smallSize: 300 }) + const action = map['photo:small'] + action(ANY_TASK, err => { + should(err).eql(null) + const downsizeArgs = shouldCallDownsize(downsize.image) + should(downsizeArgs).property('height', 300) + testEnd() + }) + }) + it('photo:large = creates a large image', testEnd => { const map = actions.createMap({ largeSize: 1000 }) const action = map['photo:large'] diff --git a/test/steps/step-cleanup.spec.js b/test/steps/step-cleanup.spec.js index 6ec5620..86b371b 100644 --- a/test/steps/step-cleanup.spec.js +++ b/test/steps/step-cleanup.spec.js @@ -26,6 +26,8 @@ describe('Steps: cleanup', () => { mock({ 'output/media/thumbs/paris/IMG_0001.jpg': '', 'output/media/thumbs/london/IMG_0002.jpg': '', + 'output/media/small/paris/IMG_0001.jpg': '', + 'output/media/small/london/IMG_0002.jpg': '', 'output/media/large/paris/IMG_0001.jpg': '', 'output/media/large/london/IMG_0002.jpg': '' })