init
Some checks failed
CI/CD / Backend & Frontend Checks (push) Has been cancelled
CI/CD / Deploy to Production (push) Has been cancelled

This commit is contained in:
2026-05-18 11:34:07 +03:30
commit 7a8ddeabed
279 changed files with 37390 additions and 0 deletions

23
backend/gallery/tasks.py Normal file
View File

@@ -0,0 +1,23 @@
from celery import shared_task
from PIL import Image
import logging
logger = logging.getLogger(__name__)
@shared_task
def process_uploaded_image(gallery_id):
"""Process uploaded image: compress, resize, extract metadata"""
try:
from .models import Gallery
gallery_item = Gallery.objects.get(id=gallery_id)
if gallery_item.image:
# This will trigger the compression and metadata extraction
gallery_item.compress_image()
logger.info(f"Processed image: {gallery_item.title}")
return f"Processed image: {gallery_item.title}"
except Exception as exc:
logger.error(f"Failed to process image: {exc}")
raise exc