initial commit
Some checks failed
Backend CI/CD / test (push) Has been cancelled
Backend CI/CD / deploy (push) Has been cancelled

This commit is contained in:
2026-05-19 20:53:08 +03:30
commit 88b793ed9f
169 changed files with 16763 additions and 0 deletions

23
apps/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