use correct mimetype when re-encoding

This commit is contained in:
Yannik Schmidt
2021-07-07 16:03:35 +02:00
parent 2347d573e8
commit 4528022a37

View File

@@ -88,7 +88,8 @@ def sendPicture(path):
scaleX = round(float(x2))
pathDebug = path
path = generatePicture(path, scaleX, scaleY, flask.request.args.get("encoding"),
encoding = flask.request.args.get("encoding")
path = generatePicture(path, scaleX, scaleY, encoding,
bool(flask.request.args.get("crop")))
if not path:
return ("File not found: {}".format(os.path.join(PICTURE_DIR, pathDebug)), 404)
@@ -107,6 +108,9 @@ def sendPicture(path):
else:
response.headers['Cache-Control'] = "max-age=" + "3600"
if encoding:
response.headers['Content-Type'] = "image/{}".format(encoding)
return response
@app.route("/")