summaryrefslogtreecommitdiff
path: root/src/lib/config.validate.source.sh
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-22 09:52:57 +0300
committerPaul Buetow <paul@buetow.org>2026-06-22 09:52:57 +0300
commit6945a0ae9afb18313636c09f34959ee5b225f78d (patch)
treee74aa7b861543f5407de863f9667b4ccc994bbbd /src/lib/config.validate.source.sh
parent79d78a296d2919155fe4d4bb2fac73d2fa7adeec (diff)
Add dynamic subdivided thumbnail tiles
Make the album preview grid livelier: with a configurable probability (THUMB_SUBDIVIDE_PERCENT, default 30%) a square thumbnail tile is subdivided into several smaller thumbnails packed into the same square footprint, chosen at random from: - quad: 2x2 squares (4 photos) - two-wide: two stacked full-width strips (2 photos) - squares+wide: two squares plus one full-width strip, strip on the top or the bottom (3 photos) Each sub-thumbnail stays its own clickable photo with its own view page; subdivision only groups consecutive photos visually, so preview numbering and the view/details/redirect pages are unchanged. No new images are generated (CSS object-fit crops the existing aspect-correct thumbs into squares or wide strips). Sub-thumbnails get the same random entry animation and the same dramatic hover (flip/scale/rotate/filter) as full thumbs. The layout choice reuses the seeded random_index, so builds stay reproducible under RANDOM_SEED. THUMB_SUBDIVIDE_PERCENT=0 reproduces the previous output byte-for-byte. The new option is wired through the config defaults, validation (0..100), --print-config, the --subdivide CLI flag, the usage text, and the shuriken.json / --dry-run metadata, with docs and tests updated. Generated HTML and CSS pass the W3C Nu HTML checker and CSS validator. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'src/lib/config.validate.source.sh')
-rw-r--r--src/lib/config.validate.source.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/config.validate.source.sh b/src/lib/config.validate.source.sh
index 28aeace..e3c55e7 100644
--- a/src/lib/config.validate.source.sh
+++ b/src/lib/config.validate.source.sh
@@ -32,6 +32,19 @@ validate_optional_positive_integer_config_var() {
fi
}
+# A percentage config var: an integer in the inclusive range 0..100. Unlike
+# validate_positive_integer_config_var, 0 is allowed (it is the natural "off"
+# value, e.g. THUMB_SUBDIVIDE_PERCENT=0 disables tile subdivision entirely).
+validate_percentage_config_var() {
+ local -r name="$1"; shift
+ local -r value="${!name}"
+
+ if [[ ! "$value" =~ ^[0-9]+$ ]] || (( value > 100 )); then
+ config_error "$name must be an integer between 0 and 100"
+ return 1
+ fi
+}
+
validate_yes_no_config_var() {
local -r name="$1"; shift
local -r value="${!name}"
@@ -273,6 +286,7 @@ validate_common_config() {
validate_optional_positive_integer_config_var HEIGHT || return
validate_positive_integer_config_var THUMBHEIGHT || return
validate_positive_integer_config_var MAXPREVIEWS || return
+ validate_percentage_config_var THUMB_SUBDIVIDE_PERCENT || return
validate_positive_integer_config_var IMAGE_JOBS || return
validate_positive_integer_config_var IMAGEMAGICK_TIMEOUT || return
validate_positive_integer_config_var TAR_TIMEOUT || return