From cb5f7f2453b7545fdf51e150e4dc80f8191e0ad2 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 31 Aug 2015 10:58:28 -0400 Subject: [PATCH] add thumb.sh tool --- contrib/tools/thumbs.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 contrib/tools/thumbs.sh diff --git a/contrib/tools/thumbs.sh b/contrib/tools/thumbs.sh new file mode 100755 index 0000000..0c38ef2 --- /dev/null +++ b/contrib/tools/thumbs.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# +# shell script for regenerating thumbnails +# + +if [ "$1" == "" ] ; then + echo "usage: $0 webroot_dir" +else + cd $1 + echo "regenerate missing thumbs in $(pwd)" + find img/ \ + -type f \ + -regextype posix-extended \ + -iregex '.*\.(png|jpg|gif)$' \ + -not -execdir test -f '../thm/{}' \; \ + -exec echo 'generating missing thumb for {}' \; \ + -exec mogrify \ + -define jpeg:size=500x500 \ + -thumbnail '250>x250>' \ + -path thm/ \ + -strip \ + '{}' \; +fi