about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2021-02-04 10:34:13 +0100
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2021-02-04 10:34:13 +0100
commit9d21606dc4e2e500a1d19de95c2e65ad26e816f5 (patch)
tree20ac620f6913d4c9399631c67520bf35ff7a92a2
parentbebf27e0e12796e2b59d1fdd658463d804a8e0cc (diff)
downloadgal-9d21606dc4e2e500a1d19de95c2e65ad26e816f5.tar.gz
gal-9d21606dc4e2e500a1d19de95c2e65ad26e816f5.zip
Add photo_list
-rwxr-xr-xgal14
1 files changed, 14 insertions, 0 deletions
diff --git a/gal b/gal
index 3ceaa13..b395a73 100755
--- a/gal
+++ b/gal
@@ -19,6 +19,7 @@ mkdir -p $2/{photos,thumbs}
 
 ## Generate index.html menu file
 cp style.css $OUTPUT
+echo "Generating index.html"
 
 cat > $OUTPUT/index.html <<EOF
 <!DOCTYPE html>
@@ -54,10 +55,23 @@ cat >> $OUTPUT/index.html <<EOF
 </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"
 done