mirror of
https://github.com/Radiquum/YAMPD.git
synced 2025-05-20 23:59:35 +05:00
format
This commit is contained in:
parent
3ef10c07cf
commit
c74170a14d
6 changed files with 20 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
from flask import Blueprint
|
||||
|
||||
api = Blueprint('api', __name__, url_prefix="/api/pack")
|
||||
api = Blueprint("api", __name__, url_prefix="/api/pack")
|
||||
|
||||
from . import pack
|
||||
from . import pack
|
||||
|
|
|
@ -8,6 +8,7 @@ from PIL import Image
|
|||
from io import BytesIO
|
||||
import base64
|
||||
|
||||
|
||||
@api.route("/new", methods=["POST"])
|
||||
def APIPackNew():
|
||||
pack = {
|
||||
|
@ -54,7 +55,9 @@ def APIPackImageEdit(id):
|
|||
if image_mime == None or image_mime not in IMG_ALLOWED_MIME:
|
||||
return jsonify({"status": "error", "message": "wrong image format"})
|
||||
|
||||
image_data = base64.b64decode(re.sub("^data:image/.+;base64,", "", request.json.get("image")))
|
||||
image_data = base64.b64decode(
|
||||
re.sub("^data:image/.+;base64,", "", request.json.get("image"))
|
||||
)
|
||||
|
||||
image = Image.open(BytesIO(image_data))
|
||||
image = image.resize((512, 512), Image.Resampling.LANCZOS)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue