commit e35b62cbcfc914a335ca9423982707daf447143f
parent 76a0106ce3540d8ba3a91509c21094316dfb7a8b
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sun, 14 Mar 2021 11:44:18 +0100
parent 76a0106ce3540d8ba3a91509c21094316dfb7a8b
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sun, 14 Mar 2021 11:44:18 +0100
gallery.nim: Remove thumbSmallWidth config-option
1 file changed, 7 insertions(+), 20 deletions(-)
diff --git a/src/gallery.nim b/src/gallery.nim @@ -17,7 +17,6 @@ type sortPictures*: SortOrder thumbMediumWidth*: int thumbMediumHeight*: int - thumbSmallWidth*: int thumbSmallHeight*: int thumbSmallQuality*: int @@ -101,21 +100,10 @@ proc createPicture(path: string): Picture = if jpgMetadata.exifData.isSome(): result.exif = jpgMetadata.exifData.get - result.width = int(jpgMetadata.sofData.get.width) - result.height = int(jpgMetadata.sofData.get.height) - - if config.thumbSmallWidth == 0: - result.thumbWidth = toInt(toFloat(result.width) / (result.height / config.thumbSmallHeight)) - result.thumbHeight = config.thumbSmallHeight - - elif config.thumbSmallHeight == 0: - result.thumbWidth = config.thumbSmallWidth - result.thumbHeight = toInt(toFloat(result.height) / (result.width / config.thumbSmallWidth)) - - else: - result.thumbWidth = config.thumbSmallWidth - result.thumbHeight = config.thumbSmallHeight - + result.width = int(jpgMetadata.sofData.get.width) + result.height = int(jpgMetadata.sofData.get.height) + result.thumbWidth = toInt(toFloat(result.width) / (result.height / config.thumbSmallHeight)) + result.thumbHeight = config.thumbSmallHeight result.name = name result.path = dir result.filename = lastPathPart(path) @@ -402,14 +390,13 @@ proc main = echo "Config-value 'TargetDir' has to be set!" quit(QuitFailure) + if config.thumbSmallHeight == 0: + config.thumbSmallHeight = 200 + if config.thumbMediumWidth == 0 and config.thumbMediumHeight == 0: config.thumbMediumWidth = 1920 config.thumbMediumHeight = 1080 - if config.thumbSmallWidth == 0 and config.thumbSmallHeight == 0: - config.thumbSmallWidth = 200 - config.thumbSmallHeight = 200 - except ValueError: let e = getCurrentException()