summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xssn.at>2010-11-28 20:44:53 +0100
committerFlorian Pritz <bluewind@xssn.at>2010-11-28 20:44:53 +0100
commit99084b5f6e18f8c9d606411192b72832abb84749 (patch)
tree0f93d1e92ed082f1ddba60acb55316e82bd76d1c
parentff77df43c44caf569912ffbe47cbaeae9f09ad02 (diff)
downloadgenerate_gallery-99084b5f6e18f8c9d606411192b72832abb84749.tar.gz
generate_gallery-99084b5f6e18f8c9d606411192b72832abb84749.tar.xz
use exiftool to generate titles
Signed-off-by: Florian Pritz <bluewind@xssn.at>
-rwxr-xr-xgenerate_gallery.sh63
1 files changed, 33 insertions, 30 deletions
diff --git a/generate_gallery.sh b/generate_gallery.sh
index 1756b4b..6efed92 100755
--- a/generate_gallery.sh
+++ b/generate_gallery.sh
@@ -1,7 +1,7 @@
#!/bin/bash
#----------------------------------------------------
-# Version: 0.3.0
-# Author: Florian "Bluewind" Pritz <flo@xssn.at>
+# Version: 0.3.0
+# Author: Florian "Bluewind" Pritz <flo@xssn.at>
#
# Licensed under WTFPL v2
# (see COPYING for full license text)
@@ -18,34 +18,37 @@ html_template="$datadir/template.html"
tempfile=$(mktemp "/tmp/image-gallery.XXXXXX")
for i in "$@"; do
- pushd "$i" &>/dev/null
- echo > $tempfile
- for img in *; do
- filename="$(basename "$img")"
- pushd "$(dirname "$img")" &>/dev/null
- mkdir -p thumbs
- if file -b --mime-type "$img" | grep -q "image/.*"; then
- if [ ! -e "thumbs/$filename" ]; then
- echo "processing: $i/$img"
- convert "$filename" -thumbnail 200x200 "thumbs/$filename"
- fi
- echo "<div class=\"thumbnail\">" \
- "<a rel=\"images\" class=\"thumbnail\" href=\"$img\">" \
- "<img class=\"thumbnail\" alt=\"\" src=\"thumbs/$img\" />" \
- "</a>" \
- "</div>" | sed -r 's/\/\//\//g' >> $tempfile
- else
- echo "ignoring non-image: $i/$img"
- fi
- popd &>/dev/null
- done
- cd "$startdir"
- sed -r \
- -e "/%%CONTENT%%/r $tempfile" \
- -e '/%%CONTENT/d' \
- "$html_template" > "$i/index.html"
- cp -r "$datadir/fancybox" "$i"
- popd &>/dev/null
+ pushd "$i" &>/dev/null
+ echo > $tempfile
+ for img in *; do
+ filename="$(basename "$img")"
+ pushd "$(dirname "$img")" &>/dev/null
+ mkdir -p thumbs
+ if file -b --mime-type "$img" | grep -q "image/.*"; then
+ if [ ! -e "thumbs/$filename" ]; then
+ echo "processing: $i/$img"
+ convert "$filename" -thumbnail 200x200 "thumbs/$filename"
+ fi
+ fnumber=$(exiftool -s -s -s -FNumber $filename)
+ focallength=$(exiftool -s -s -s -FocalLength $filename)
+ shutterspeed=$(exiftool -s -s -s -ShutterSpeed $filename)
+ echo "<div class=\"thumbnail\">" \
+ "<a rel=\"images\" class=\"thumbnail\" title=\"${shutterspeed}s, $focallength @ F $fnumber\" href=\"$img\">" \
+ "<img class=\"thumbnail\" alt=\"\" src=\"thumbs/$img\" />" \
+ "</a>" \
+ "</div>" | sed -r 's/\/\//\//g' >> $tempfile
+ else
+ echo "ignoring non-image: $i/$img"
+ fi
+ popd &>/dev/null
+ done
+ cd "$startdir"
+ sed -r \
+ -e "/%%CONTENT%%/r $tempfile" \
+ -e '/%%CONTENT/d' \
+ "$html_template" > "$i/index.html"
+ cp -r "$datadir/fancybox" "$i"
+ popd &>/dev/null
done
rm $tempfile