mirror of
https://github.com/FAUSheppy/python-flask-picture-factory
synced 2025-12-06 07:01:37 +01:00
fix: send unmodified file if picture can not be loaded
This commit is contained in:
@@ -37,6 +37,8 @@ def generatePicture(pathToOrig, scaleX, scaleY, encoding, crop):
|
|||||||
image = PIL.Image.open(os.path.join(PICTURE_DIR, pathToOrig))
|
image = PIL.Image.open(os.path.join(PICTURE_DIR, pathToOrig))
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
return (None, False)
|
return (None, False)
|
||||||
|
except PIL.UnidentifiedImageError:
|
||||||
|
return (os.path.join(PICTURE_DIR, pathToOrig), False)
|
||||||
|
|
||||||
# ensure sizes are valid #
|
# ensure sizes are valid #
|
||||||
x, y = image.size
|
x, y = image.size
|
||||||
|
|||||||
Reference in New Issue
Block a user