fix png not working because of removing too many bytes of data url header

This commit is contained in:
csd4ni3l
2025-08-09 11:39:11 +02:00
parent a8ee1c90ae
commit 104b87d555

View File

@@ -17,8 +17,6 @@ login_manager.init_app(app)
os.makedirs("uploads", exist_ok=True)
users = {}
class User(flask_login.UserMixin):
pass
@@ -57,9 +55,12 @@ def resize_image_file(path, max_side=256, fmt="JPEG"):
@app.route("/upload", methods=["POST"])
def upload():
try:
image_type, image_data = request.json["image_type"], request.json["image_data"].encode("utf-8")
image_type, image_data = request.json["username"], request.json["image_type"], request.json["image_data"].encode("utf-8")
if image_type == "jpeg":
image_data = image_data[23:] # data:image/jpeg;base64,
else:
image_data = image_data[22:]
image_uuid = uuid.uuid4()