This commit is contained in:
Username 2022-10-21 19:23:54 -04:00
parent 4a5032da5e
commit 206bf69cec
2 changed files with 5 additions and 5 deletions

View File

@ -1,3 +1,3 @@
pillow pillow
tornado tornado==6.1.0
natsort natsort

View File

@ -235,7 +235,6 @@ class ImgHandler(tornado.web.RequestHandler):
""" """
def get(self,string=None): def get(self,string=None):
# Set default values # Set default values
sizex = 300 sizex = 300
sizey = 300 sizey = 300
@ -250,16 +249,17 @@ class ImgHandler(tornado.web.RequestHandler):
# Rather than trying to fix the intercows, we can support this with directories... <grumble> # Rather than trying to fix the intercows, we can support this with directories... <grumble>
# We'll translate /abc.png/s_100x100/set_any to be /abc.png?set=any&s=100x100 # We'll translate /abc.png/s_100x100/set_any to be /abc.png?set=any&s=100x100
# We're using underscore as a replacement for = and / as a replacement for [&?] # We're using underscore as a replacement for = and / as a replacement for [&?]
args = self.request.arguments.copy() args = self.request.arguments.copy()
for k in list(args.keys()): for k in list(args.keys()):
v = args[k] v = args[k]
if type(v) is list: if type(v) is list:
if len(v) > 0: if len(v) > 0:
args[k] = args[k][0] args[k] = args[k][0].decode('utf-8')
else: else:
args[k] = "" args[k] = ""
if type(v) is bytes:
args[k] = v.decode('utf-8')
# Detect if they're using the above slash-separated parameters.. # Detect if they're using the above slash-separated parameters..
# If they are, then remove those parameters from the query string. # If they are, then remove those parameters from the query string.
@ -285,7 +285,7 @@ class ImgHandler(tornado.web.RequestHandler):
# Split the size variable in to sizex and sizey # Split the size variable in to sizex and sizey
if "size" in args: if "size" in args:
sizex,sizey = args['size'].split("x") sizex,sizey = args.get('size').split("x")
sizex = int(sizex) sizex = int(sizex)
sizey = int(sizey) sizey = int(sizey)
if sizex > 4096 or sizex < 0: if sizex > 4096 or sizex < 0: