mirror of
https://github.com/FAUSheppy/python-flask-picture-factory
synced 2025-12-05 22:51:36 +01:00
use correct mimetype when re-encoding
This commit is contained in:
@@ -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("/")
|
||||
|
||||
Reference in New Issue
Block a user