tweak thumbnailer to not modify gifs and give good feedback

This commit is contained in:
Iris Lightshard 2021-05-17 22:09:25 -06:00
parent 7e7c2f8003
commit 76fc3e88ff
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398

View file

@ -20,7 +20,11 @@ pathtrans() {
resize() { resize() {
output=$(pathtrans $1) output=$(pathtrans $1)
if echo $1 | grep .gif > /dev/null; then
return
fi
if [ ! -f ${output} ]; then if [ ! -f ${output} ]; then
echo "generating thumbnail for $1"
convert $1 -strip -auto-orient -resize ${SIZE} -dither FloydSteinberg -colors 16 ${output} convert $1 -strip -auto-orient -resize ${SIZE} -dither FloydSteinberg -colors 16 ${output}
fi fi
replace $1 ${output} replace $1 ${output}
@ -35,11 +39,14 @@ replace() {
src=$(echo "src='${src}'") src=$(echo "src='${src}'")
dest=$(echo "src='${dest}'") dest=$(echo "src='${dest}'")
echo -n "modifying html to use thumbnail for $1"
for f in $(find ${ROOT}/*.html); do 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 sed -i s#${src}#${dest}# $f
fi fi
done done
echo
} }
echo "creating new thumbnails" echo "creating new thumbnails"