kopia lustrzana https://github.com/wagtail/wagtail
rodzic
a449e2d8b2
commit
2a6f908972
|
@ -203,9 +203,9 @@ Output image format
|
||||||
|
|
||||||
Wagtail may automatically change the format of some images when they are resized:
|
Wagtail may automatically change the format of some images when they are resized:
|
||||||
|
|
||||||
- PNG and JPEG images always won't change format
|
- PNG and JPEG images don't change format
|
||||||
- GIF images without animation are converted to PNGs
|
- GIF images without animation are converted to PNGs
|
||||||
- BMP images are always converted to PNGs
|
- BMP images are converted to PNGs
|
||||||
|
|
||||||
It is also possible to override the output format on a per-tag basis by using the
|
It is also possible to override the output format on a per-tag basis by using the
|
||||||
``format`` filter after the resize rule.
|
``format`` filter after the resize rule.
|
||||||
|
@ -237,8 +237,15 @@ quality:
|
||||||
# Make low-quality but small images
|
# Make low-quality but small images
|
||||||
WAGTAILIMAGES_JPEG_QUALITY = 40
|
WAGTAILIMAGES_JPEG_QUALITY = 40
|
||||||
|
|
||||||
Note that this won't affect any previously generated images. You may want to
|
Note that this won't affect any previously generated images so you may want to
|
||||||
delete all renditions so they can regenerate with the new setting.
|
delete all renditions so they can regenerate with the new setting. This can be
|
||||||
|
done from the Django shell:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
# Replace this with your custom rendition model if you use one
|
||||||
|
>>> from wagtail.wagtailimages.models import Rendition
|
||||||
|
>>> Rendition.objects.all().delete()
|
||||||
|
|
||||||
Changing per-tag
|
Changing per-tag
|
||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
|
@ -417,8 +417,7 @@ class Filter(models.Model):
|
||||||
'original-format': original_format,
|
'original-format': original_format,
|
||||||
}
|
}
|
||||||
for operation in self.operations:
|
for operation in self.operations:
|
||||||
# Check that the operation can take the new "env" argument
|
# Check that the operation can take the "env" argument
|
||||||
# (added in Wagtail 1.5)
|
|
||||||
try:
|
try:
|
||||||
inspect.getcallargs(operation.run, willow, image, env)
|
inspect.getcallargs(operation.run, willow, image, env)
|
||||||
accepts_env = True
|
accepts_env = True
|
||||||
|
|
|
@ -414,7 +414,7 @@ class TestFilter(TestCase):
|
||||||
self.assertEqual(run_mock.call_count, 2)
|
self.assertEqual(run_mock.call_count, 2)
|
||||||
|
|
||||||
def test_runs_operations_without_env_argument(self):
|
def test_runs_operations_without_env_argument(self):
|
||||||
# The "env" argument was added in Wagtial 1.5. This tests that
|
# The "env" argument was added in Wagtail 1.5. This tests that
|
||||||
# image operations written for 1.4 will still work
|
# image operations written for 1.4 will still work
|
||||||
|
|
||||||
run_mock = Mock()
|
run_mock = Mock()
|
||||||
|
|
Ładowanie…
Reference in New Issue