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:
parent
fde4c6e04b
commit
b3d5187c6c
|
@ -367,14 +367,14 @@ class Files( object ):
|
||||||
# scale the image down into a thumbnail
|
# scale the image down into a thumbnail
|
||||||
THUMBNAIL_MAX_SIZE = ( 125, 125 ) # in pixels
|
THUMBNAIL_MAX_SIZE = ( 125, 125 ) # in pixels
|
||||||
image.thumbnail( THUMBNAIL_MAX_SIZE, Image.ANTIALIAS )
|
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:
|
except IOError:
|
||||||
image = Image.open( "static/images/default_thumbnail.png" )
|
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 ):
|
def stream( image_buffer ):
|
||||||
CHUNK_SIZE = 8192
|
CHUNK_SIZE = 8192
|
||||||
|
|
||||||
|
|
Reference in New Issue