fix image resizing requiring 2 paths instead of 1

This commit is contained in:
csd4ni3l
2025-08-08 23:27:21 +02:00
parent cccd7a1e30
commit 7b7b23bbc0

View File

@@ -47,12 +47,12 @@ def register():
return f"Username: {username}\nPassword: {password}" return f"Username: {username}\nPassword: {password}"
def resize_image_file(input_path, output_path, max_side=384, fmt="JPEG"): def resize_image_file(path, max_side=384, fmt="JPEG"):
img = Image.open(input_path) img = Image.open(path)
scale = max_side / max(img.size) scale = max_side / max(img.size)
if scale < 1: if scale < 1:
img = img.resize((int(img.width * scale), int(img.height * scale)), Image.LANCZOS) img = img.resize((int(img.width * scale), int(img.height * scale)), Image.LANCZOS)
img.save(output_path, format=fmt) img.save(path, format=fmt)
@app.route("/upload", methods=["POST"]) @app.route("/upload", methods=["POST"])
def upload(): def upload():