Archived
1
0
This repository has been archived on 2023-08-12. You can view files and clone it, but cannot push or open issues or pull requests.
nntpchan/contrib/tools/thumbs.sh
2015-09-05 11:05:32 -04:00

24 lines
575 B
Bash
Executable File

#!/usr/bin/env bash
#
# shell script for regenerating thumbnails
#
if [ "$1" == "" ] ; then
echo "usage: $0 webroot_dir"
else
cd $1/img
echo "regenerate missing thumbs in $(pwd)"
find . \
-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/{}.jpg' \
-strip \
'{}' \;
fi