From b3d5187c6cdc7a5164e6b899ecd75fc7535ab9e1 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Tue, 22 Apr 2008 18:34:34 +0000 Subject: [PATCH] Fixed bug where calling image.save() with an interlaced PNG file would raise an IOError. Now just displaying the default thumbnail if that happens. --- controller/Files.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/controller/Files.py b/controller/Files.py index dddb0d9..8fb543a 100644 --- a/controller/Files.py +++ b/controller/Files.py @@ -367,14 +367,14 @@ class Files( object ): # scale the image down into a thumbnail THUMBNAIL_MAX_SIZE = ( 125, 125 ) # in pixels image.thumbnail( THUMBNAIL_MAX_SIZE, Image.ANTIALIAS ) + + # save the image into a memory buffer + image_buffer = StringIO() + image.save( image_buffer, "PNG" ) + image_buffer.seek( 0 ) except IOError: image = Image.open( "static/images/default_thumbnail.png" ) - # save the image into a memory buffer - image_buffer = StringIO() - image.save( image_buffer, "PNG" ) - image_buffer.seek( 0 ) - def stream( image_buffer ): CHUNK_SIZE = 8192