summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils <git@nkn-it.de>2023-02-19 16:45:23 +0100
committerNils <git@nkn-it.de>2023-02-19 16:45:23 +0100
commit660e83d5bd6f0ac2fbed2a6aea0c71b698be8eb7 (patch)
treedb9f362225d76fe55044c339598f989971212458
parent1133d367b25208b799fb3fd162bedd34fad67e7f (diff)
16x9 and retina fix
-rwxr-xr-xgallery.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/gallery.sh b/gallery.sh
index 7e4606a..b7e9b89 100755
--- a/gallery.sh
+++ b/gallery.sh
@@ -8,7 +8,7 @@
#### Configuration Section
#########################################################################################
-MY_HEIGHT_SMALL=187
+MY_HEIGHT_SMALL=406
MY_HEIGHT_LARGE=768
MY_QUALITY=85
MY_THUMBDIR="__thumbs"
@@ -22,7 +22,7 @@ MY_CONVERT_COMMAND="convert"
MY_EXIF_COMMAND="jhead"
# Bootstrap 4
-MY_CSS="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css"
+MY_CSS="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.2/css/bootstrap.min.css"
# Debugging output
# true=enable, false=disable
@@ -93,7 +93,7 @@ command -v $MY_EXIF_COMMAND >/dev/null 2>&1 || { echo >&2 "!!! $MY_EXIF_COMMAND
MY_HEIGHTS[0]=$MY_HEIGHT_SMALL
MY_HEIGHTS[1]=$MY_HEIGHT_LARGE
-for MY_RES in ${MY_HEIGHTS[*]}; do
+for MY_RES in "${MY_HEIGHTS[@]}"; do
[[ -d "$MY_THUMBDIR/$MY_RES" ]] || mkdir -p "$MY_THUMBDIR/$MY_RES" || exit 3
done
@@ -125,13 +125,14 @@ EOF
### Photos (JPG)
if [[ $(find . -maxdepth 1 -type f -iname \*.jpg | wc -l) -gt 0 ]]; then
-echo '<div class="row row-cols-sm-1 row-cols-md-2 row-cols-lg-3 row-cols-xl-4 py-5">' >> "$MY_INDEX_HTML_FILE"
+MY_ROWS='3'
+echo '<div class="row row-cols-sm-1 row-cols-md-'"$((MY_ROWS-2))"' row-cols-lg-'"$((MY_ROWS-1))"' row-cols-xl-'"$MY_ROWS"' py-5">' >> "$MY_INDEX_HTML_FILE"
## Generate Images
MY_NUM_FILES=0
for MY_FILENAME in *.[jJ][pP][gG]; do
MY_FILELIST[$MY_NUM_FILES]=$MY_FILENAME
(( MY_NUM_FILES++ ))
- for MY_RES in ${MY_HEIGHTS[*]}; do
+ for MY_RES in "${MY_HEIGHTS[@]}"; do
if [[ ! -s $MY_THUMBDIR/$MY_RES/$MY_FILENAME ]]; then
debugOutput "$MY_THUMBDIR/$MY_RES/$MY_FILENAME"
$MY_CONVERT_COMMAND -auto-orient -strip -quality $MY_QUALITY -resize x$MY_RES "$MY_FILENAME" "$MY_THUMBDIR/$MY_RES/$MY_FILENAME"
@@ -140,7 +141,7 @@ for MY_FILENAME in *.[jJ][pP][gG]; do
cat >> "$MY_INDEX_HTML_FILE" << EOF
<div class="col">
<p>
- <a href="$MY_THUMBDIR/$MY_FILENAME.html"><img src="$MY_THUMBDIR/$MY_HEIGHT_SMALL/$MY_FILENAME" alt="Thumbnail: $MY_FILENAME" class="rounded mx-auto d-block"></a>
+ <a href="$MY_THUMBDIR/$MY_FILENAME.html"><img src="$MY_THUMBDIR/$MY_HEIGHT_SMALL/$MY_FILENAME" alt="Thumbnail: $MY_FILENAME" class="rounded mx-auto d-block" height="$((MY_HEIGHT_SMALL/2))"></a>
</p>
</div>
EOF