Skip to content

Instantly share code, notes, and snippets.

@tariquesani
Last active August 2, 2016 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tariquesani/077d50214778bb86ecb461eda16774c2 to your computer and use it in GitHub Desktop.
Save tariquesani/077d50214778bb86ecb461eda16774c2 to your computer and use it in GitHub Desktop.
QnD bash script to resize images for Lektor content
#!/bin/bash
echo "Started watching (Press CRTL+C to quit) "
while true; do
inotifywait -q -e moved_to -r ./content |
while read path action file; do
echo "The file '$file' appeared in directory '$path' via '$action'"
if [ $file == 'contents.lr' ]
then
echo "The file '$file' can't be cropped. Skipping"
else
smartcrop --facedetection --width 250 --height 250 $path/$file $path/square_$file
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment