chiark / gitweb /
skeleton-gallery: Script to create a skeleton gallery.xml for a directory of
authorColin Watson <cjwatson@chiark.greenend.org.uk>
Sun, 2 Feb 2003 16:34:57 +0000 (16:34 +0000)
committerColin Watson <cjwatson@chiark.greenend.org.uk>
Sun, 2 Feb 2003 16:34:57 +0000 (16:34 +0000)
photos.

skeleton-gallery [new file with mode: 0755]

diff --git a/skeleton-gallery b/skeleton-gallery
new file mode 100755 (executable)
index 0000000..0d4a319
--- /dev/null
@@ -0,0 +1,32 @@
+#! /bin/sh
+set -e
+
+exec >gallery.xml
+
+cat <<EOF
+<gallery title="" perpage=""
+         authorname="Colin Watson" authoremail="cjwatson@flatline.org.uk">
+EOF
+
+index=0
+
+for x in *.jpg; do
+    index=$(($index + 1))
+    if [ "$index" -ne 1 ]; then
+       echo
+    fi
+    printf '  <photo id="%d"' "$index"
+    identify "$x" | \
+       perl -ne '/(\d+)x(\d+)/ and print qq{ width="$1" height="$2"}'
+    cat <<EOF
+>
+    <p></p>
+  </photo>
+EOF
+done
+
+cat <<EOF
+</gallery>
+
+<!-- vim: set tw=76 sts=2 sw=2 et: -->
+EOF