Mercurial > hg > montage
changeset 12:e9be444c874b
really use a thumbnail if it exists
author | k0s <k0scist@gmail.com> |
---|---|
date | Fri, 25 Dec 2009 19:35:46 -0500 |
parents | 8353caad836c |
children | ca43a7f71985 |
files | montage/formatters.py |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/montage/formatters.py Fri Dec 25 19:29:37 2009 -0500 +++ b/montage/formatters.py Fri Dec 25 19:35:46 2009 -0500 @@ -62,19 +62,21 @@ create_thumbnail = False if os.path.exists(thumbnail_file): - # ensure the size is smaller than the specified size try: + # ensure the size is smaller than the specified size thumb = Image.open(thumbnail_file) + if self.width and thumb.size[0] > self.width: + create_thumbnail = True + if self.height and thumb.size[1] > self.height: + create_thumbnail = True + except: - continue - if self.width and thumb.size[0] > self.width: - create_thumbnail = True - if self.height and thumb.size[1] > self.height: - create_thumbnail = True + pass # ensure the original file has not been modified if os.path.getmtime(thumbnail_file) < os.path.getmtime(filepath): create_thumbnail = True + else: # create a new thumbnail create_thumbnail = True