Commit cc51d808 authored by fred's avatar fred
Browse files

thumbnails: return transparent pixel as data URI if missing image

parent 05df31e8
......@@ -15,7 +15,11 @@ def thumbnail(image, size='100x100'):
# defining the size
x, y = [int(x) for x in size.split('x')]
# defining the filename and the miniature filename
filehead, filetail = os.path.split(image.path)
filehead, filetail = os.path.split(image.path)
except ValueError:
# return transparent pixel if the image doesn't actually exist
basename, format = os.path.splitext(filetail)
if format.lower() not in ('.jpg', '.jpeg'):
format = '.png'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment