--- a/lib/image.py Tue Mar 18 00:04:02 2008 +0000
+++ b/lib/image.py Sun May 04 18:23:03 2008 +0000
@@ -22,6 +22,8 @@
import PIL.Image
+import dexif
+
import settings, utils, log
from template import image as image_tpl
@@ -68,6 +70,9 @@
# the ShortURL code for this image
self.shorturl_code = None
+ # EXIF data
+ self.exif_data = {}
+
# what to use in the rendered templates, intended to be overridden by subclasses
self.series_act = "add"
self.series_verb = "Add to"
@@ -124,6 +129,14 @@
if utils.mtime(self.html_path) < self.timestamp :
log.info("render %s.html", self.name)
+ # parse the exif data from the file
+ try :
+ self.exif_data = dexif.parse_exif(self.path)
+ except dexif.ExifError, message:
+ log.warning("Reading EXIF data for %s failed: %s" % (self.filename, message))
+ self.exif_data = {}
+
+
image_tpl.render_to(self.html_path,
stylesheet_url = self.dir.inRoot('style.css'),
title = self.title,
@@ -139,6 +152,7 @@
img_size = self.img_size,
file_size = self.filesize,
timestamp = self.timestamp,
+ exif_data = self.exif_data,
shorturl = self.dir.inRoot('s', self.shorturl_code),
shorturl_code = self.shorturl_code,