witten
/
luminotes
Archived
1
0
Fork 0

Fixed bug where calling image.save() with an interlaced PNG file would

raise an IOError. Now just displaying the default thumbnail if that
happens.
This commit is contained in:
Dan Helfman 2008-04-22 18:34:34 +00:00
parent fde4c6e04b
commit b3d5187c6c
1 changed files with 5 additions and 5 deletions

View File

@ -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