degal/image.py
author Tero Marttila <terom@fixme.fi>
Wed, 03 Jun 2009 19:03:28 +0300
branchuse-distutils
changeset 41 3b1579a7bffb
parent 33 lib/image.py@4943047bfcb5
child 44 533b7e8b5d3b
permissions -rw-r--r--
reorganize files to move lib, templates, www into 'degal' package, keep separate 'cgi-bin' for now
14
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
     1
# DeGAL - A pretty simple web image gallery
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
     2
# Copyright (C) 2007 Tero Marttila
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
     3
# http://marttila.de/~terom/degal/
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
     4
#
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
     5
# This program is free software; you can redistribute it and/or modify
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
     6
# it under the terms of the GNU General Public License as published by
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
     7
# the Free Software Foundation; either version 2 of the License, or
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
     8
# (at your option) any later version.
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
     9
#
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
    10
# This program is distributed in the hope that it will be useful,
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
    11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
    12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
    13
# GNU General Public License for more details.
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
    14
#
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
    15
# You should have received a copy of the GNU General Public License
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
    16
# along with this program; if not, write to the
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
    17
# Free Software Foundation, Inc.,
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
    18
# 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
    19
#
4b5478da5850 remove hanging utils.py in root, and add GPL license header to all .py files
terom
parents: 13
diff changeset
    20
12
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    21
import os, os.path
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    22
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    23
import PIL.Image
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    24
33
4943047bfcb5 merged http://pajukanta.fi/temp/degal_exif_r33.tar.bz2 patch from Japsu
terom
parents: 28
diff changeset
    25
import dexif
4943047bfcb5 merged http://pajukanta.fi/temp/degal_exif_r33.tar.bz2 patch from Japsu
terom
parents: 28
diff changeset
    26
28
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
    27
import settings, utils, log
12
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    28
from template import image as image_tpl
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    29
    
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    30
class Image (object) :
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    31
    def __init__ (self, dir, name) :
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    32
        # the image filename, e.g. DSC3948.JPG
27
301d738b1181 fix some unicode issues, and not-alive-dirs-in-subdirs-list issues
terom
parents: 14
diff changeset
    33
        self.name = unicode(name)
12
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    34
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    35
        # the Folder object that we are in
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    36
        self.dir = dir
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    37
        
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    38
        # the relative path from the root to us
27
301d738b1181 fix some unicode issues, and not-alive-dirs-in-subdirs-list issues
terom
parents: 14
diff changeset
    39
        self.path = dir.pathFor(self.name)
12
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    40
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    41
        # the basename+ext, e.g. DSCR3948, .JPG
27
301d738b1181 fix some unicode issues, and not-alive-dirs-in-subdirs-list issues
terom
parents: 14
diff changeset
    42
        self.base_name, self.ext = os.path.splitext(self.name)
12
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    43
        
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    44
        # our user-friendly title
27
301d738b1181 fix some unicode issues, and not-alive-dirs-in-subdirs-list issues
terom
parents: 14
diff changeset
    45
        self.title = self.name
12
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    46
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    47
        # our long-winded description
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    48
        self.descr = ''
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    49
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    50
        # the image before and after us, both may be None
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    51
        self.prev = self.next = None
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    52
        
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    53
        # the image-relative names for the html page, thumb and preview images
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    54
        self.html_name = self.name + ".html"
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    55
        self.thumb_name = utils.url_join(settings.THUMB_DIR, self.name)
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    56
        self.preview_name = utils.url_join(settings.PREVIEW_DIR, self.name)
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    57
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    58
        # the root-relative paths to the html page, thumb and preview images
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    59
        self.html_path = self.dir.pathFor(self.html_name)
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    60
        self.thumb_path = self.dir.pathFor(settings.THUMB_DIR, self.name)
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    61
        self.preview_path = self.dir.pathFor(settings.PREVIEW_DIR, self.name)        
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    62
        
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    63
        #
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    64
        # Figured out after prepare
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    65
        #
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    66
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    67
        # (w, h) tuple
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    68
        self.img_size = None
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    69
        
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    70
        # the ShortURL code for this image
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    71
        self.shorturl_code = None
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    72
33
4943047bfcb5 merged http://pajukanta.fi/temp/degal_exif_r33.tar.bz2 patch from Japsu
terom
parents: 28
diff changeset
    73
	# EXIF data
4943047bfcb5 merged http://pajukanta.fi/temp/degal_exif_r33.tar.bz2 patch from Japsu
terom
parents: 28
diff changeset
    74
	self.exif_data = {}
4943047bfcb5 merged http://pajukanta.fi/temp/degal_exif_r33.tar.bz2 patch from Japsu
terom
parents: 28
diff changeset
    75
12
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    76
        # what to use in the rendered templates, intended to be overridden by subclasses
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    77
        self.series_act = "add"
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    78
        self.series_verb = "Add to"
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    79
    
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    80
    def getObjInfo (self) :
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    81
        """
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    82
            Metadata for shorturl2.db
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    83
        """
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    84
        return 'img', self.dir.path, self.name
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    85
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    86
    def breadcrumb (self) :
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    87
        """
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    88
            Returns a [(fname, title)] list of this image's parents
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    89
       """
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    90
        
13
c229bcb1de41 image breadcrumb links back to page that said image is on
terom
parents: 12
diff changeset
    91
        return self.dir.breadcrumb(forImg=self) + [(self.html_name, self.title)]
12
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    92
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    93
    def render (self) :
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    94
        """
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    95
            Write out the .html file
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    96
        """
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    97
        
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    98
        # stat the image file to get the filesize and mtime
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
    99
        st = os.stat(self.path)
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   100
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   101
        self.filesize = st.st_size
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   102
        self.timestamp = st.st_mtime
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   103
        
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   104
        # open the image in PIL to get image attributes + generate thumbnails
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   105
        img = PIL.Image.open(self.path)
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   106
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   107
        self.img_size = img.size
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   108
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   109
        for out_path, geom in ((self.thumb_path, settings.THUMB_GEOM), (self.preview_path, settings.PREVIEW_GEOM)) :
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   110
            # if it doesn't exist, or it's older than the image itself, generate
28
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   111
            if utils.mtime(out_path) < self.timestamp :
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   112
                log.info("render [%sx%s]", geom[0], geom[1], wait=True)
12
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   113
                
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   114
                # XXX: is this the most efficient way to do this? It seems slow
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   115
                out_img = img.copy()
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   116
                out_img.thumbnail(geom, resample=True)
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   117
                out_img.save(out_path)
28
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   118
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   119
                log.done()
12
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   120
        
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   121
        # look for the metadata file
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   122
        title_path = self.dir.pathFor(self.base_name + '.txt')
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   123
        
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   124
        self.title, self.descr = utils.readTitleDescr(title_path)
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   125
        
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   126
        if not self.title :
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   127
            self.title = self.name
28
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   128
        
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   129
        if utils.mtime(self.html_path) < self.timestamp :
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   130
            log.info("render %s.html", self.name)
12
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   131
33
4943047bfcb5 merged http://pajukanta.fi/temp/degal_exif_r33.tar.bz2 patch from Japsu
terom
parents: 28
diff changeset
   132
            # parse the exif data from the file
4943047bfcb5 merged http://pajukanta.fi/temp/degal_exif_r33.tar.bz2 patch from Japsu
terom
parents: 28
diff changeset
   133
            try :
4943047bfcb5 merged http://pajukanta.fi/temp/degal_exif_r33.tar.bz2 patch from Japsu
terom
parents: 28
diff changeset
   134
                    self.exif_data = dexif.parse_exif(self.path)
4943047bfcb5 merged http://pajukanta.fi/temp/degal_exif_r33.tar.bz2 patch from Japsu
terom
parents: 28
diff changeset
   135
            except dexif.ExifError, message:
4943047bfcb5 merged http://pajukanta.fi/temp/degal_exif_r33.tar.bz2 patch from Japsu
terom
parents: 28
diff changeset
   136
                    log.warning("Reading EXIF data for %s failed: %s" % (self.filename, message))
4943047bfcb5 merged http://pajukanta.fi/temp/degal_exif_r33.tar.bz2 patch from Japsu
terom
parents: 28
diff changeset
   137
                    self.exif_data = {}
4943047bfcb5 merged http://pajukanta.fi/temp/degal_exif_r33.tar.bz2 patch from Japsu
terom
parents: 28
diff changeset
   138
4943047bfcb5 merged http://pajukanta.fi/temp/degal_exif_r33.tar.bz2 patch from Japsu
terom
parents: 28
diff changeset
   139
28
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   140
            image_tpl.render_to(self.html_path,
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   141
                stylesheet_url             = self.dir.inRoot('style.css'),
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   142
                title                      = self.title,
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   143
                breadcrumb                 = self.breadcrumb(),
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   144
                
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   145
                prev                       = self.prev,
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   146
                next                       = self.next,
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   147
                img                        = self,
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   148
                
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   149
                description                = self.descr,
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   150
                
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   151
                filename                   = self.name,
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   152
                img_size                   = self.img_size,
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   153
                file_size                  = self.filesize,
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   154
                timestamp                  = self.timestamp,
33
4943047bfcb5 merged http://pajukanta.fi/temp/degal_exif_r33.tar.bz2 patch from Japsu
terom
parents: 28
diff changeset
   155
		exif_data		   = self.exif_data,
28
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   156
                
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   157
                shorturl                   = self.dir.inRoot('s', self.shorturl_code),
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   158
                shorturl_code              = self.shorturl_code,
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   159
                
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   160
                series_url                 = self.dir.inRoot('series/%s/%s' % (self.series_act, self.shorturl_code)),
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   161
                series_verb                = self.series_verb,
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   162
            )   
12
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   163
    
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   164
    def __str__ (self) :
c2d8e9a754a1 Major code restructuring. Version is now 0.5, templates use Mako, and the code is split off into several files under lib/
terom
parents:
diff changeset
   165
        return "Image `%s' in `%s'" % (self.name, self.dir.path)
28
70b6c13d084f fancy new log format
terom
parents: 27
diff changeset
   166