Skip to content

Commit

Permalink
Add setting for image upload path
Browse files Browse the repository at this point in the history
  • Loading branch information
Starcross committed Oct 31, 2024
1 parent 16bbe4d commit f3f3b3e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ The actual preview and thumbnail sizes are multiplied by this number, but render

Margin between thumbnails in px. This can create a more or less condensed look

**GALLERY_IMAGES_PATH** -- Default: "images"

Upload directory for images

Troubleshooting
---------------
Expand Down
2 changes: 1 addition & 1 deletion models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class Image(models.Model):

data = models.ImageField(upload_to='images')
data = models.ImageField(upload_to=settings.GALLERY_IMAGES_PATH)
data_thumbnail = ImageSpecField(
source='data',
processors=[ResizeToFit(height=settings.GALLERY_THUMBNAIL_SIZE * settings.GALLERY_HDPI_FACTOR)],
Expand Down
2 changes: 2 additions & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@
GALLERY_IMAGE_MARGIN = getattr(settings, 'GALLERY_IMAGE_MARGIN', 6.0)
# CSS Color Styling
GALLERY_THEME_COLOR = getattr(settings, 'GALLERY_THEME_COLOR', "black")
# Image upload path
GALLERY_IMAGES_PATH = getattr(settings, 'GALLERY_IMAGE_PATH', "images")

0 comments on commit f3f3b3e

Please sign in to comment.