#!/bin/bash
# --- ImageGallery.sh ---
# This Script uses ImageMagick to convert Pictures to 640x480 and makes a
# Thumbnail of them. Then it adds a watermark to the Pictures
# 
# Version:		0.3
# Author:		René Standfest <rene@standfest.net>
# Homapage:	http://www.standfest.net 
# 
# --- Using ---
# Edit the script and fill the watermark variable
# Call script with "ImageGallery.sh /path/to/the/pics"
# 
# When the script finished you have a subfolder called "gallery" in
# your picturefolder, which contains the gallerized pictures including the
# watermark, and another subfolder under "gallery" called thumbs, which
# contains the thumbnails.

path=$1
watermark= # FILL THIS FIRST!
mkdir -p $path/gallery/thumbs

cd $path
for i in $(ls); do
	picture=$i
	convert -quality 50 -resize 640x640 $picture gallery/$picture
	convert -resize 160x160 gallery/$picture thumbs/$picture
	composite -gravity SouthEast $watermark gallery/$picture gallery/$picture
done
