Skip to content
This repository has been archived by the owner on Sep 22, 2020. It is now read-only.

Commit

Permalink
Add THUMBNAIL_FORCE_FORMAT setting #14
Browse files Browse the repository at this point in the history
  • Loading branch information
relekang committed Apr 3, 2015
1 parent 3c98e02 commit 5c485f0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ Image options
supported this format will be used.
| **Defaults:** ``'JPEG'``
.. attribute:: THUMBNAIL_FALLBACK_FORMAT
:noindex:

| This will override the original image format, however, passing format into ``get_thumbnail``
will override this value.
| **Defaults:** ``None``
.. attribute:: THUMBNAIL_ALTERNATIVE_RESOLUTIONS
:noindex:

Expand Down
1 change: 1 addition & 0 deletions thumbnails/conf/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
THUMBNAIL_QUALITY = 90
THUMBNAIL_COLORMODE = 'RGB'
THUMBNAIL_FALLBACK_FORMAT = 'JPEG'
THUMBNAIL_FORCE_FORMAT = None
THUMBNAIL_ALTERNATIVE_RESOLUTIONS = [2]

THUMBNAIL_FILTER_SIZE = '500'
Expand Down
2 changes: 2 additions & 0 deletions thumbnails/engines/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ def default_options(self):
def get_format(self, image, options):
if 'format' in options:
return options['format']
if settings.THUMBNAIL_FORCE_FORMAT is not None:
return settings.THUMBNAIL_FORCE_FORMAT
image_format = self.engine_get_format(image)
if image_format:
return image_format
Expand Down

0 comments on commit 5c485f0

Please sign in to comment.