From 1800909661b5c7992a19a3a37d084925d936d731 Mon Sep 17 00:00:00 2001 From: aramesh-site deploy Date: Wed, 30 Sep 2026 09:39:18 +0000 Subject: [PATCH] =?UTF-8?q?fix(media):=20=D8=A7=D8=A8=D8=B9=D8=A7=D8=AF=20?= =?UTF-8?q?=D8=AE=D8=B1=D9=88=D8=AC=DB=8C=20FFmpeg=20=D8=A8=D8=A7=20Pillow?= =?UTF-8?q?=20=D8=AE=D9=88=D8=A7=D9=86=D8=AF=D9=87=20=D8=B4=D9=88=D8=AF=20?= =?UTF-8?q?=E2=80=94=20ffprobe=20=D8=B1=D9=88=DB=8C=20WebP=20=D8=B5=D9=81?= =?UTF-8?q?=D8=B1=20=D8=A8=D8=B1=D9=85=DB=8C=E2=80=8C=DA=AF=D8=B1=D8=AF?= =?UTF-8?q?=D8=A7=D9=86=D8=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/admin.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/app/api/admin.py b/backend/app/api/admin.py index 06dbef5..a5a0b75 100644 --- a/backend/app/api/admin.py +++ b/backend/app/api/admin.py @@ -460,9 +460,11 @@ def _ffmpeg_webp(data: bytes) -> tuple[bytes, int | None, int | None]: run_convert(["-frames:v", "1"], still_vf) with open(dst, "rb") as fh: out = fh.read() - dims = _ffprobe_video(dst)[0] or {} - width = int(dims["width"]) if dims.get("width") else None - height = int(dims["height"]) if dims.get("height") else None + # ffprobe روی WebP عرض/ارتفاع صفر برمی‌گرداند — ابعاد از خود خروجی با Pillow + try: + width, height = Image.open(io.BytesIO(out)).size + except Exception: + width = height = None return out, width, height