##// END OF EJS Templates
Fixed image decoding with the new python3 IO module
neko259 -
r767:92c00ade default
parent child Browse files
Show More
@@ -51,13 +51,13 b' def generate_thumb(img, thumb_size, form'
51 image2 = image
51 image2 = image
52 image2.thumbnail(thumb_size, Image.ANTIALIAS)
52 image2.thumbnail(thumb_size, Image.ANTIALIAS)
53
53
54 string_io = io.StringIO()
54 output = io.BytesIO()
55 # PNG and GIF are the same, JPG is JPEG
55 # PNG and GIF are the same, JPG is JPEG
56 if format.upper() == 'JPG':
56 if format.upper() == 'JPG':
57 format = 'JPEG'
57 format = 'JPEG'
58
58
59 image2.save(string_io, format)
59 image2.save(output, format)
60 return ContentFile(string_io.getvalue())
60 return ContentFile(output.getvalue())
61
61
62
62
63 class ImageWithThumbsFieldFile(ImageFieldFile):
63 class ImageWithThumbsFieldFile(ImageFieldFile):
General Comments 0
You need to be logged in to leave comments. Login now