Fixed spelling of a variable name

This commit is contained in:
Martin Green 2022-06-25 23:36:53 +01:00
parent 5de88ce92d
commit 24a016e76a

View File

@ -12,10 +12,10 @@ import troggle.settings as settings
from troggle.lib import version_control
MAX_IMAGE_WIDTH = 1000
MAX_IMAGE_HEIGTH = 800
MAX_IMAGE_HEIGHT = 800
THUMBNAIL_WIDTH = 200
THUMBNAIL_HEIGTH = 200
THUMBNAIL_HEIGHT = 200
def image_selector(request, path):
'''Returns available images'''
@ -48,10 +48,10 @@ def new_image_form(request, path):
binary_data.write(chunk)
i = Image.open(binary_data)
width, height = i.size
if width > MAX_IMAGE_WIDTH or height > MAX_IMAGE_HEIGTH:
scale = max(width / MAX_IMAGE_WIDTH, height / MAX_IMAGE_HEIGTH)
if width > MAX_IMAGE_WIDTH or height > MAX_IMAGE_HEIGHT:
scale = max(width / MAX_IMAGE_WIDTH, height / MAX_IMAGE_HEIGHT)
i = i.resize((int(width / scale), int(height / scale)), Image.ANTIALIAS)
tscale = max(width / THUMBNAIL_WIDTH, height / THUMBNAIL_HEIGTH)
tscale = max(width / THUMBNAIL_WIDTH, height / THUMBNAIL_HEIGHT)
thumbnail = i.resize((int(width / tscale), int(height / tscale)), Image.ANTIALIAS)
ib = io.BytesIO()
i.save(ib, format="png")