#!/usr/bin/python
import os, Image, cgi
print """Content-Type: text/html
Panoramic Images
"""
l = []
for f in os.listdir("."):
if not f.endswith(".jpg") and not f.endswith(".jpeg"):
continue
i = Image.open(f)
if i.size[0]*1.0/i.size[1] > 2 and \
i.size[0] > 2000 and i.size[0] < 3000:
link = ".".join(f.replace("-gimped", "").split(".")[:-1]) + ".html"
l.append((link, f, 1024, 1024*i.size[1]/i.size[0]))
del i
l.sort()
print "My %u Panoramas
" % len(l)
for link, f, w, h in l:
print "" % (cgi.escape(link), cgi.escape(f), w, h)
print """
Special Photo Series
All Photo Series
"""