summaryrefslogtreecommitdiff
path: root/gallery
diff options
context:
space:
mode:
Diffstat (limited to 'gallery')
-rwxr-xr-xgallery44
1 files changed, 44 insertions, 0 deletions
diff --git a/gallery b/gallery
new file mode 100755
index 0000000..e134e23
--- /dev/null
+++ b/gallery
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+gallery
+make a nice little web gallery
+
+Patrick Simianer <p@simianer.de>
+2010-03-31
+"""
+
+import sys, os, glob, subprocess, shlex
+
+
+def main():
+ try:
+ path = sys.argv[1]
+ except IndexError:
+ print 'Usage: gallery.py /path/to/images/'
+ sys.exit(1)
+ path += '/'
+ files = glob.glob(path+'*.jpg')
+ if not os.path.exists(path+'thumbs'):
+ os.mkdir(path+'thumbs')
+ files.sort()
+ for f in files:
+ cmd = 'convert "'+f+'" -resize 320x320 "'+path+'thumbs/'+f.split('/')[-1]+'"'
+ a = shlex.split(cmd)
+ subprocess.Popen(a)
+
+ print '<html><head><title></title></head><body style="background:#000">'
+ print '<div style="text-align:center"><p style="font-size:0.8em;color:#303030">Anklicken zum Vergr&ouml;&szlig;ern</p>'
+ for f in files:
+ print '<div style="padding:16px;">'
+ print '<a href="'+f+'" target="_blank"><img style="border:2px solid #303030" src="thumbs/'+f+'" /></a>'
+ print '</div>'
+ print '</div></body></html>'
+
+
+
+
+if __name__ == '__main__':
+ main()
+