From 76fc3e88ff43a81fd61ddebf5e0243087aa2e8a9 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Mon, 17 May 2021 22:09:25 -0600 Subject: [PATCH] tweak thumbnailer to not modify gifs and give good feedback --- thumbnailer.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/thumbnailer.sh b/thumbnailer.sh index d8c8c7e..fcb93c7 100755 --- a/thumbnailer.sh +++ b/thumbnailer.sh @@ -20,7 +20,11 @@ pathtrans() { resize() { output=$(pathtrans $1) + if echo $1 | grep .gif > /dev/null; then + return + fi if [ ! -f ${output} ]; then + echo "generating thumbnail for $1" convert $1 -strip -auto-orient -resize ${SIZE} -dither FloydSteinberg -colors 16 ${output} fi replace $1 ${output} @@ -35,11 +39,14 @@ replace() { src=$(echo "src='${src}'") dest=$(echo "src='${dest}'") + echo -n "modifying html to use thumbnail for $1" for f in $(find ${ROOT}/*.html); do - if grep ${src} ${f}; then + echo -n "." + if grep ${src} ${f} > /dev/null; then sed -i s#${src}#${dest}# $f fi done + echo } echo "creating new thumbnails"