kopia lustrzana https://github.com/wagtail/wagtail
rodzic
0f4fabb355
commit
877da3de95
|
@ -4,6 +4,7 @@ import os.path
|
||||||
import hashlib
|
import hashlib
|
||||||
import re
|
import re
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
import warnings
|
||||||
|
|
||||||
from six import BytesIO, text_type
|
from six import BytesIO, text_type
|
||||||
|
|
||||||
|
@ -309,7 +310,18 @@ class Filter(models.Model):
|
||||||
|
|
||||||
if willow.original_format == 'jpeg':
|
if willow.original_format == 'jpeg':
|
||||||
# Allow changing of JPEG compression quality
|
# 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)
|
willow.save_as_jpeg(output, quality=quality)
|
||||||
else:
|
else:
|
||||||
willow.save(willow.original_format, output)
|
willow.save(willow.original_format, output)
|
||||||
|
|
Ładowanie…
Reference in New Issue