about summary refs log tree commit diff
path: root/gal
diff options
context:
space:
mode:
Diffstat (limited to 'gal')
-rwxr-xr-xgal96
1 files changed, 0 insertions, 96 deletions
diff --git a/gal b/gal
deleted file mode 100755
index 6dbcfd4..0000000
--- a/gal
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/bin/sh
-## Script for generating photo gallery website
-##
-## Usage:
-## $ ./gal [PHOTOS DIR] [OUTPUT DIR]
-##
-## Setting custom title:
-## $ TITLE=Title ./gal [AS ABOVE]
-
-## === Customize ===
-
-QUALITY=70
-THUMBNAIL_RESOLUTION=250
-RESOLUTION=1500
-
-## =================
-
-[ -z $1 ] && echo "You need to pass photos dir" && exit 1
-[ -z $2 ] && echo "You need to pass output dir" && exit 1
-
-PHOTOS=$1
-OUTPUT=$2
-TITLE=${TITLE:-$(basename $OUTPUT)}
-mkdir -p $2/{photos,thumbs}
-
-## Generate index.html menu file
-cp style.css $OUTPUT
-chmod 644 $OUTPUT/style.css
-echo "Generating index.html"
-
-cat > $OUTPUT/index.html <<EOF
-<!DOCTYPE html>
-<html>
-  <head>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width">
-    <title>$TITLE</title>
-    <link rel="stylesheet" href="style.css" type="text/css" >
-  </head>
-  <body>
-    <h1>$TITLE</h1>
-    <h3>Last update: $(date '+%d.%m.%Y')</h3>
-    <div class="tiles">
-EOF
-
-
-for f in $PHOTOS/*.{jpg,JPG,jpeg,JPEG,png,PNG}; do
-  filename=$(basename $f)
-  [ -f $f ] && cat >> $OUTPUT/index.html <<EOF
-      <div class="tile">
-        <a href="photos/$filename">
-          <picture>
-            <source srcset="thumbs/${filename%.*}.webp" type="image/webp">
-            <source srcset="thumbs/$filename" type="image/${filename##*.}">
-            <img src="thumbs/$filename" alt="$filename" />
-          </picture>
-        </a>
-      </div>
-EOF
-done
-
-cat >> $OUTPUT/index.html <<EOF
-    </div>
-    <footer>
-      <p>Pobierz: <a href="archive_$TITLE.zip">📁 Archiwum</a></p>
-      <p>This page is <a href="https://jeffhuang.com/designed_to_last/">designed to last</a>.</p>
-    </footer>
-  </body>
-</html>
-EOF
-
-## Generate photo_list
-echo "Generating photo_list"
-
-[ -f $OUTPUT/photo_list ] && echo "Replacing existing photo_list" && rm $OUTPUT/photo_list
-
-for f in $PHOTOS/*.{jpg,JPG,jpeg,JPEG,png,PNG}; do
-  filename=$(basename $f)
-  [ -f $f ] && cat >> $OUTPUT/photo_list <<EOF
-$filename
-EOF
-done
-
-## Optimize images
-
-for f in $PHOTOS/*.{jpg,JPG,jpeg,JPEG,png,PNG}; do
-  filename=$(basename $f)
-  echo "Optimizing $filename"
-  [ -f $f ] && convert -auto-orient -strip -quality $QUALITY -resize x$RESOLUTION "$f" "$OUTPUT/photos/$filename" && \
-    convert -auto-orient -strip -quality $QUALITY -resize x$THUMBNAIL_RESOLUTION "$f" "$OUTPUT/thumbs/$filename" && \
-    cwebp -q $QUALITY -resize 400 0 $f -o "$OUTPUT/thumbs/${filename%.*}.webp"
-done
-
-## Create zip archive
-
-zip $OUTPUT/"archive_$TITLE.zip" -r $OUTPUT/photos