0001-misc-ignore-thumbnailing-errors-8954.patch
wcs/forms/root.py | ||
---|---|---|
942 | 942 | |
943 | 943 |
file_pointer = get_session().get_tempfile_content(t).get_file_pointer() |
944 | 944 |
if Image is not None and get_request().form.get('thumbnail') == '1': |
945 |
image = Image.open(file_pointer) |
|
946 |
image.thumbnail((500, 300)) |
|
947 |
image_thumb_fp = StringIO() |
|
948 |
image.save(image_thumb_fp, "PNG") |
|
945 |
try: |
|
946 |
image = Image.open(file_pointer) |
|
947 |
image.thumbnail((500, 300)) |
|
948 |
image_thumb_fp = StringIO() |
|
949 |
image.save(image_thumb_fp, "PNG") |
|
950 |
except IOError: |
|
951 |
# too bad we couldn't load the image, return the whole file :/ |
|
952 |
return file_pointer.read() |
|
949 | 953 |
return image_thumb_fp.getvalue() |
950 | 954 |
else: |
951 | 955 |
return file_pointer.read() |
952 |
- |