about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2021-02-08 13:08:30 +0100
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2021-02-08 13:08:30 +0100
commit042589d39cb987008666e671444f0b8e40b38e74 (patch)
tree65de9836cdb05969b94a872da80818280f542678
parentd9eb1efea06b6f8d3b65e4953ae2d5cad0c4fa41 (diff)
downloadgalier-042589d39cb987008666e671444f0b8e40b38e74.tar.gz
galier-042589d39cb987008666e671444f0b8e40b38e74.zip
Add archive
-rwxr-xr-xgal8
1 files changed, 7 insertions, 1 deletions
diff --git a/gal b/gal
index 24da9fd..6dbcfd4 100755
--- a/gal
+++ b/gal
@@ -15,7 +15,8 @@ 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
@@ -61,6 +62,7 @@ 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>
@@ -88,3 +90,7 @@ for f in $PHOTOS/*.{jpg,JPG,jpeg,JPEG,png,PNG}; do
     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