mirror of
https://github.com/FAUSheppy/flask-json-dream-website
synced 2025-12-06 08:11:35 +01:00
round earlier for better filenames
This commit is contained in:
@@ -257,8 +257,8 @@ def generatePicture(pathToOrig, scaleX, scaleY, encoding):
|
|||||||
x, y = image.size
|
x, y = image.size
|
||||||
if not scaleY:
|
if not scaleY:
|
||||||
scaleY = y
|
scaleY = y
|
||||||
scaleX = min(x, round(float(scaleX)))
|
scaleX = min(x, scaleX)
|
||||||
scaleY = min(y, round(float(scaleY)))
|
scaleY = min(y, scaleY)
|
||||||
|
|
||||||
# generate new paths #
|
# generate new paths #
|
||||||
newFile = "x-{x}-y-{y}-{fname}.{ext}".format(x=scaleX, y=scaleY, fname=filename, ext=encoding)
|
newFile = "x-{x}-y-{y}-{fname}.{ext}".format(x=scaleX, y=scaleY, fname=filename, ext=encoding)
|
||||||
@@ -276,9 +276,12 @@ def generatePicture(pathToOrig, scaleX, scaleY, encoding):
|
|||||||
def sendPicture(path):
|
def sendPicture(path):
|
||||||
cache_timeout = 2592000
|
cache_timeout = 2592000
|
||||||
|
|
||||||
scaleX = flask.request.args.get("scalex")
|
|
||||||
scaleY = flask.request.args.get("scaley")
|
scaleY = flask.request.args.get("scaley")
|
||||||
|
scaleX = flask.request.args.get("scalex")
|
||||||
|
if scaleY:
|
||||||
|
scaleY = round(float(scaleY))
|
||||||
if scaleX:
|
if scaleX:
|
||||||
|
scaleX = round(float(scaleX))
|
||||||
path = generatePicture(path, scaleX, scaleY, flask.request.args.get("encoding"))
|
path = generatePicture(path, scaleX, scaleY, flask.request.args.get("encoding"))
|
||||||
|
|
||||||
raw = flask.send_from_directory(app.config["PICTURES_DIR"], path, cache_timeout=cache_timeout)
|
raw = flask.send_from_directory(app.config["PICTURES_DIR"], path, cache_timeout=cache_timeout)
|
||||||
|
|||||||
Reference in New Issue
Block a user