# HG changeset patch # User neko259 # Date 2014-08-07 10:21:26 # Node ID 92c00adedc7c8d247aa2630888acbf3c5473251b # Parent 10f4d0f778fa0f0f8880b9a4212962a60991a7fa Fixed image decoding with the new python3 IO module diff --git a/boards/thumbs.py b/boards/thumbs.py --- a/boards/thumbs.py +++ b/boards/thumbs.py @@ -51,13 +51,13 @@ def generate_thumb(img, thumb_size, form image2 = image image2.thumbnail(thumb_size, Image.ANTIALIAS) - string_io = io.StringIO() + output = io.BytesIO() # PNG and GIF are the same, JPG is JPEG if format.upper() == 'JPG': format = 'JPEG' - image2.save(string_io, format) - return ContentFile(string_io.getvalue()) + image2.save(output, format) + return ContentFile(output.getvalue()) class ImageWithThumbsFieldFile(ImageFieldFile):