diff --git a/Makefile b/Makefile index 24e12ab..74a15ec 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,9 @@ serve: build: hugo --minify +copy-photos: + bash create-thumbs.sh + clean-build: hugo --cleanDestinationDir --minify diff --git a/create-thumbs.sh b/create-thumbs.sh new file mode 100755 index 0000000..c896acc --- /dev/null +++ b/create-thumbs.sh @@ -0,0 +1,12 @@ +cd static/img +ln -s ../../../thomasba.de-photos/ orig +find orig/ -type f -iname '*.jpg' | while read -r ORIGINAL ; do + FILENAME="photos/${ORIGINAL#orig/}" + THUMB="${FILENAME/%.jpg/-thumb.jpg}" + FOLDER="${FILENAME%$(basename "$FILENAME")}" + echo "Processing \"$ORIGINAL\"..." + [ -d "$FOLDER" ] || mkdir -p "$FOLDER" + [ -f "$THUMB" ] || convert "$ORIGINAL" -strip -quality 0.75 -resize 400x400\> "$THUMB" + [ -f "$FILENAME" ] || convert "$ORIGINAL" -quality 0.80 -resize 2560x2560\> "$FILENAME" +done +rm orig