Projet

Général

Profil

0001-misc-ignore-thumbnailing-errors-8954.patch

Frédéric Péters, 12 novembre 2015 10:32

Télécharger (1,29 ko)

Voir les différences:

Subject: [PATCH] misc: ignore thumbnailing errors (#8954)

 wcs/forms/root.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
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
-