iamge path

This commit is contained in:
IGNY8 VPS (Salman)
2025-11-12 05:23:28 +00:00
parent db5698a1db
commit 7ff3eafb51
4 changed files with 7 additions and 16 deletions

View File

@@ -402,19 +402,11 @@ class ImagesViewSet(SiteSectorModelViewSet):
# Try alternative locations based on the filename
filename = os.path.basename(file_path)
alternative_paths = [
'/data/app/igny8/images/' + filename, # Primary location
'/data/app/igny8/frontend/public/images/ai-images/' + filename, # Primary location (web-accessible)
'/data/app/igny8/images/' + filename, # Secondary location
'/data/app/images/' + filename, # Fallback location
]
# Also try project-relative path
try:
from django.conf import settings
from pathlib import Path
base_dir = Path(settings.BASE_DIR) if hasattr(settings, 'BASE_DIR') else Path(__file__).resolve().parent.parent.parent
alternative_paths.append(str(base_dir / 'data' / 'app' / 'images' / filename))
except Exception:
pass
# Try each alternative path
found = False
for alt_path in alternative_paths: