kopia lustrzana https://github.com/wagtail/wagtail
Fix ico format conversion to work in template
rodzic
ebc77dda83
commit
f5552c4044
|
@ -18,6 +18,7 @@ Changelog
|
||||||
* Fix: Support SVG icon id attributes with single quotes in the styleguide (Sage Abdullah)
|
* Fix: Support SVG icon id attributes with single quotes in the styleguide (Sage Abdullah)
|
||||||
* Fix: Do not show delete button on model edit views if per-instance permissions prevent deletion (Matt Westcott)
|
* Fix: Do not show delete button on model edit views if per-instance permissions prevent deletion (Matt Westcott)
|
||||||
* Fix: Remove duplicate header in privacy dialog when a privacy setting is set on a parent page or collection (Matthias Brück)
|
* Fix: Remove duplicate header in privacy dialog when a privacy setting is set on a parent page or collection (Matthias Brück)
|
||||||
|
* Fix: Allow renditions of `.ico` images (Julie Rymer)
|
||||||
* Docs: Remove duplicate section on frontend caching proxies from performance page (Jake Howard)
|
* Docs: Remove duplicate section on frontend caching proxies from performance page (Jake Howard)
|
||||||
* Docs: Document `restriction_type` field on PageViewRestriction (Shlomo Markowitz)
|
* Docs: Document `restriction_type` field on PageViewRestriction (Shlomo Markowitz)
|
||||||
* Docs: Document Wagtail's bug bounty policy (Jake Howard)
|
* Docs: Document Wagtail's bug bounty policy (Jake Howard)
|
||||||
|
|
|
@ -818,6 +818,7 @@
|
||||||
* Saksham Misra
|
* Saksham Misra
|
||||||
* Nigel van Keulen
|
* Nigel van Keulen
|
||||||
* Matthias Brück
|
* Matthias Brück
|
||||||
|
* Julie Rymer
|
||||||
|
|
||||||
## Translators
|
## Translators
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ depth: 1
|
||||||
* Support SVG icon id attributes with single quotes in the styleguide (Sage Abdullah)
|
* Support SVG icon id attributes with single quotes in the styleguide (Sage Abdullah)
|
||||||
* Do not show delete button on model edit views if per-instance permissions prevent deletion (Matt Westcott)
|
* Do not show delete button on model edit views if per-instance permissions prevent deletion (Matt Westcott)
|
||||||
* Remove duplicate header in privacy dialog when a privacy setting is set on a parent page or collection (Matthias Brück)
|
* Remove duplicate header in privacy dialog when a privacy setting is set on a parent page or collection (Matthias Brück)
|
||||||
|
* Allow renditions of `.ico` images (Julie Rymer)
|
||||||
|
|
||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
|
|
|
@ -449,7 +449,8 @@ You can encode the image into lossless AVIF or WebP format by using `format-avif
|
||||||
You can save images as a `.ico` file using `format-ico`, which is especially useful when managing a site's favicon through the Admin.
|
You can save images as a `.ico` file using `format-ico`, which is especially useful when managing a site's favicon through the Admin.
|
||||||
|
|
||||||
```html+django
|
```html+django
|
||||||
<link rel="icon" href="{% image favicon_image format-ico %}" />
|
{% image favicon_image format-ico as favicon_image_formatted %}
|
||||||
|
<link rel="icon" type="image/x-icon" href="{{ favicon_image_formatted.url }}"/>
|
||||||
```
|
```
|
||||||
|
|
||||||
(image_background_colour)=
|
(image_background_colour)=
|
||||||
|
|
|
@ -59,6 +59,7 @@ IMAGE_FORMAT_EXTENSIONS = {
|
||||||
"gif": ".gif",
|
"gif": ".gif",
|
||||||
"webp": ".webp",
|
"webp": ".webp",
|
||||||
"svg": ".svg",
|
"svg": ".svg",
|
||||||
|
"ico": ".ico",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
from pathlib import Path
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
|
@ -11,6 +12,7 @@ from wagtail.images.exceptions import (
|
||||||
)
|
)
|
||||||
from wagtail.images.image_operations import TransformOperation
|
from wagtail.images.image_operations import TransformOperation
|
||||||
from wagtail.images.models import Filter, Image
|
from wagtail.images.models import Filter, Image
|
||||||
|
from wagtail.images.shortcuts import get_rendition_or_not_found
|
||||||
from wagtail.images.tests.utils import (
|
from wagtail.images.tests.utils import (
|
||||||
get_test_image_file,
|
get_test_image_file,
|
||||||
get_test_image_file_avif,
|
get_test_image_file_avif,
|
||||||
|
@ -693,6 +695,16 @@ class TestFormatFilter(TestCase):
|
||||||
|
|
||||||
self.assertEqual(out.format_name, "ico")
|
self.assertEqual(out.format_name, "ico")
|
||||||
|
|
||||||
|
def test_ico_rendition(self):
|
||||||
|
fil = Filter(spec="width-400|format-ico")
|
||||||
|
good_image = Image.objects.create(
|
||||||
|
title="Test image",
|
||||||
|
file=get_test_image_file(),
|
||||||
|
)
|
||||||
|
|
||||||
|
rendition = get_rendition_or_not_found(good_image, fil)
|
||||||
|
self.assertEqual(Path(rendition.file.name).suffix, ".ico")
|
||||||
|
|
||||||
def test_webp_lossless(self):
|
def test_webp_lossless(self):
|
||||||
fil = Filter(spec="width-400|format-webp-lossless")
|
fil = Filter(spec="width-400|format-webp-lossless")
|
||||||
image = Image.objects.create(
|
image = Image.objects.create(
|
||||||
|
|
Ładowanie…
Reference in New Issue