diff options
-rwxr-xr-x | generate_gallery.sh | 63 |
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 |