# HG changeset patch # User k0s # Date 1261787746 18000 # Node ID e9be444c874bfceb784831079802048a66d57dd7 # Parent 8353caad836cc8779226a82f80f812d98854fefd really use a thumbnail if it exists diff -r 8353caad836c -r e9be444c874b montage/formatters.py --- 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