From b359bd318296210c25bdb20b8dc26965c1cc9ac8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
Date: Tue, 12 Jan 2016 09:48:00 +0800
Subject: [PATCH] Pass filename instead of file object when calling
PIL.Image.save()
---
mediagoblin/media_types/ascii/processing.py | 7 ++-----
mediagoblin/media_types/image/processing.py | 3 +--
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/mediagoblin/media_types/ascii/processing.py b/mediagoblin/media_types/ascii/processing.py
index ed6600e..00d04e6 100644
a
|
b
|
class CommonAsciiProcessor(MediaProcessor):
|
143 | 143 | thumb = converter._create_image( |
144 | 144 | orig_file.read()) |
145 | 145 | |
146 | | with open(tmp_thumb, 'w') as thumb_file: |
147 | | thumb.thumbnail( |
148 | | thumb_size, |
149 | | Image.ANTIALIAS) |
150 | | thumb.save(thumb_file) |
| 146 | thumb.thumbnail(thumb_size, Image.ANTIALIAS) |
| 147 | thumb.save(tmp_thumb); |
151 | 148 | |
152 | 149 | thumb_info = {'font': font, |
153 | 150 | 'width': thumb_size[0], |
diff --git a/mediagoblin/media_types/image/processing.py b/mediagoblin/media_types/image/processing.py
index 951a720..14091d6 100644
a
|
b
|
def resize_image(entry, resized, keyname, target_name, new_size,
|
77 | 77 | |
78 | 78 | # Copy the new file to the conversion subdir, then remotely. |
79 | 79 | tmp_resized_filename = os.path.join(workdir, target_name) |
80 | | with open(tmp_resized_filename, 'wb') as resized_file: |
81 | | resized.save(resized_file, quality=quality) |
| 80 | resized.save(tmp_resized_filename, quality=quality) |
82 | 81 | store_public(entry, keyname, tmp_resized_filename, target_name) |
83 | 82 | |
84 | 83 | # store the thumb/medium info |