Show More
@@ -51,13 +51,13 b' def generate_thumb(img, thumb_size, form' | |||
|
51 | 51 | image2 = image |
|
52 | 52 | image2.thumbnail(thumb_size, Image.ANTIALIAS) |
|
53 | 53 | |
|
54 | string_io = io.StringIO() | |
|
54 | output = io.BytesIO() | |
|
55 | 55 | # PNG and GIF are the same, JPG is JPEG |
|
56 | 56 | if format.upper() == 'JPG': |
|
57 | 57 | format = 'JPEG' |
|
58 | 58 | |
|
59 |
image2.save( |
|
|
60 |
return ContentFile( |
|
|
59 | image2.save(output, format) | |
|
60 | return ContentFile(output.getvalue()) | |
|
61 | 61 | |
|
62 | 62 | |
|
63 | 63 | class ImageWithThumbsFieldFile(ImageFieldFile): |
General Comments 0
You need to be logged in to leave comments.
Login now