Refactor Dockerfile and backend API for improved image processing and dependency management

This commit is contained in:
hlohaus 2025-10-31 03:52:10 +01:00
parent f571237eb7
commit 9b3e7a69d2
4 changed files with 9 additions and 22 deletions

View file

@ -21,7 +21,7 @@ from urllib.parse import quote_plus
from hashlib import sha256
try:
from PIL import Image
from PIL import Image, UnidentifiedImageError
has_pillow = True
except ImportError:
has_pillow = False
@ -452,7 +452,10 @@ class Backend_Api(Api):
image_size = {"width": width, "height": height}
thumbnail_dir = os.path.join(bucket_dir, "thumbnail")
os.makedirs(thumbnail_dir, exist_ok=True)
process_image(image, save=os.path.join(thumbnail_dir, filename))
width, height = process_image(image, save=os.path.join(thumbnail_dir, filename))
image_size = {"width": width, "height": height}
except UnidentifiedImageError:
pass
except Exception as e:
logger.exception(e)
if result: