fix: address PR review issues for catalogue images
- Use PNG format instead of JPEG for transparency support - Non-strict mode only resizes if image width > target width - Replace CATALOGUE_BACKGROUND_IMAGES_COLOR with CATALOGUE_BACKGROUND_IMAGES_RGBA (tuple default (0,0,0,0)) - Move all inline imports to top of test file - Add test_resize_non_strict_no_upscale test case - Add comment explaining settings.DEBUG guard for media serving
This commit is contained in:
@@ -146,7 +146,12 @@ MEDIA_URL = "/media/"
|
||||
CATALOGUE_IMAGE_WIDTH = int(os.environ.get("CATALOGUE_IMAGE_WIDTH", "600"))
|
||||
CATALOGUE_IMAGE_HEIGHT = int(os.environ.get("CATALOGUE_IMAGE_HEIGHT", "600"))
|
||||
CATALOGUE_STRICT_DIMENSION = os.environ.get("CATALOGUE_STRICT_DIMENSION", "False").lower() in ("true", "1", "yes")
|
||||
CATALOGUE_BACKGROUND_IMAGES_COLOR = os.environ.get("CATALOGUE_BACKGROUND_IMAGES_COLOR") or None
|
||||
CATALOGUE_BACKGROUND_IMAGES_RGBA = os.environ.get(
|
||||
"CATALOGUE_BACKGROUND_IMAGES_RGBA", "0,0,0,0"
|
||||
)
|
||||
# Parse RGBA string to tuple
|
||||
_rgba_parts = CATALOGUE_BACKGROUND_IMAGES_RGBA.split(",")
|
||||
CATALOGUE_BACKGROUND_IMAGES_RGBA = tuple(int(p.strip()) for p in _rgba_parts)
|
||||
CATALOGUE_MAX_UPLOAD_SIZE = int(os.environ.get("CATALOGUE_MAX_UPLOAD_SIZE", str(5 * 1024 * 1024)))
|
||||
|
||||
# Default primary key field type
|
||||
|
||||
@@ -35,5 +35,7 @@ urlpatterns = [
|
||||
path('api/users/', include('users.urls')),
|
||||
]
|
||||
|
||||
# Serve media files through Django only in development.
|
||||
# In production/staging, media is served by the web server (nginx).
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
Reference in New Issue
Block a user