mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-04-27 18:14:48 +00:00
parent
0f4fabb355
commit
877da3de95
1 changed files with 13 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import os.path
|
|||
import hashlib
|
||||
import re
|
||||
from contextlib import contextmanager
|
||||
import warnings
|
||||
|
||||
from six import BytesIO, text_type
|
||||
|
||||
|
|
@ -309,7 +310,18 @@ class Filter(models.Model):
|
|||
|
||||
if willow.original_format == 'jpeg':
|
||||
# Allow changing of JPEG compression quality
|
||||
quality = getattr(settings, 'WAGTAILIMAGES_JPEG_QUALITY', 85)
|
||||
if hasattr(settings, 'WAGTAILIMAGES_JPEG_QUALITY'):
|
||||
quality = settings.WAGTAILIMAGES_JPEG_QUALITY
|
||||
elif hasattr(settings, 'IMAGE_COMPRESSION_QUALITY'):
|
||||
quality = settings.IMAGE_COMPRESSION_QUALITY
|
||||
|
||||
warnings.warn(
|
||||
"The IMAGE_COMPRESSION_QUALITY setting has been renamed to "
|
||||
"WAGTAILIMAGES_JPEG_QUALITY. Please update your settings."
|
||||
, RemovedInWagtail11Warning)
|
||||
else:
|
||||
quality = 85
|
||||
|
||||
willow.save_as_jpeg(output, quality=quality)
|
||||
else:
|
||||
willow.save(willow.original_format, output)
|
||||
|
|
|
|||
Loading…
Reference in a new issue