===================
Wagtail Picture Tag
===================
Wagtail Picture Tag adds a picture template tag.
This is not supposed to be a solution for all situations but to be
a shortcut for most.
It accepts 3 main types of filters: formats, resizing methods and sizes.
Formats
-------
By default it will try and create JPEG, PNG, WEBP and AVIF (if available).
You may use `format-jpeg`, `format-png`, `format-webp`, `format-gif` and `format-avif`
There are also two format shortcuts:
- photo - will create JPEG, WEBP and AVIF
- transparent - will create WEBP, PNG and AVIF
Resizing
--------
Resizing methods are the same as Wagtails with the exception that you
can provide multiple filters
Sizes
-----
Sizes are automatically generated to match resizing filters provided but
can be specified for more responsive sizes.
`size-250px` will create `sizes="250px"`
`size-max100-300vw size-250px` will create `sizes="(max-width: 300px) 100vw, 250px"`
Lazy
----
It also takes the argument `lazy` that simply adds `loading="lazy"` to the HTML tag.
AVIF
----
Currently Willow (the image library used by Wagtail) does not support AVIF
but support can be patched in by installing `willowavif` package.
Quick start
-----------
1. Install the package::
pip install wagtail-picture-tag
2. Add "wagtail-picture-tag" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [
...
'wagtail_picture_tag',
]
3. Include the tag in your template::
{% load picture_tags %}
4. Use the tag::
{% picture image photo fill-640x480 fill-320x240 %}
AVIF support
------------
All that is needed is to install the `willowavif` package, it is
then automatically imported and used.
Testing
-------
.. image:: https://circleci.com/gh/bengosney/wagtail-picture-tag/tree/main.svg?style=svg
:target: https://circleci.com/gh/bengosney/wagtail-picture-tag/tree/main
Testing is done with pytest. Install and test can be done with::
pip install -r requirements.txt -r requirements.dev.txt
pytest
Raw data
{
"_id": null,
"home_page": "",
"name": "wagtail-picture-tag",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "",
"author": "",
"author_email": "Ben Gosney <bengosney@googlemail.com>",
"download_url": "https://files.pythonhosted.org/packages/b7/e2/c92e29e074d6c80e12920c58c56a56f4583eb51fc744606bca31884dc128/wagtail-picture-tag-2.0.1.tar.gz",
"platform": null,
"description": "===================\nWagtail Picture Tag\n===================\n\nWagtail Picture Tag adds a picture template tag.\nThis is not supposed to be a solution for all situations but to be\na shortcut for most.\n\nIt accepts 3 main types of filters: formats, resizing methods and sizes.\n\nFormats\n-------\nBy default it will try and create JPEG, PNG, WEBP and AVIF (if available).\n\nYou may use `format-jpeg`, `format-png`, `format-webp`, `format-gif` and `format-avif`\n\nThere are also two format shortcuts:\n\n- photo - will create JPEG, WEBP and AVIF\n- transparent - will create WEBP, PNG and AVIF\n\nResizing\n--------\nResizing methods are the same as Wagtails with the exception that you\ncan provide multiple filters\n\nSizes\n-----\nSizes are automatically generated to match resizing filters provided but\ncan be specified for more responsive sizes.\n\n`size-250px` will create `sizes=\"250px\"`\n`size-max100-300vw size-250px` will create `sizes=\"(max-width: 300px) 100vw, 250px\"`\n\nLazy\n----\nIt also takes the argument `lazy` that simply adds `loading=\"lazy\"` to the HTML tag.\n\n\nAVIF\n----\nCurrently Willow (the image library used by Wagtail) does not support AVIF\nbut support can be patched in by installing `willowavif` package.\n\n\nQuick start\n-----------\n\n1. Install the package::\n\n pip install wagtail-picture-tag\n\n2. Add \"wagtail-picture-tag\" to your INSTALLED_APPS setting like this::\n\n INSTALLED_APPS = [\n ...\n 'wagtail_picture_tag',\n ]\n\n3. Include the tag in your template::\n\n {% load picture_tags %}\n\n4. Use the tag::\n\n {% picture image photo fill-640x480 fill-320x240 %}\n\n\nAVIF support\n------------\n\nAll that is needed is to install the `willowavif` package, it is\nthen automatically imported and used.\n\n\nTesting\n-------\n.. image:: https://circleci.com/gh/bengosney/wagtail-picture-tag/tree/main.svg?style=svg\n :target: https://circleci.com/gh/bengosney/wagtail-picture-tag/tree/main\n\nTesting is done with pytest. Install and test can be done with::\n\n pip install -r requirements.txt -r requirements.dev.txt\n pytest\n",
"bugtrack_url": null,
"license": "GNU General Public License v3 or later (GPLv3+)",
"summary": "A Wagtail app to add a picture tag.",
"version": "2.0.1",
"project_urls": {
"Homepage": "https://github.com/bengosney/wagtail-picture-tag"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "91fc06b0c55da57910c673a2c3a60cb7ccee61d7d17482119719bfb1aa6aa954",
"md5": "ca9c6b9003b5185c7e4b53462f00ce07",
"sha256": "f8c2f387c7776419470725ac0b4c65713d4e2c1c3f3995e5df6d01a85fcbe8c8"
},
"downloads": -1,
"filename": "wagtail_picture_tag-2.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ca9c6b9003b5185c7e4b53462f00ce07",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 20853,
"upload_time": "2023-10-29T16:08:30",
"upload_time_iso_8601": "2023-10-29T16:08:30.979111Z",
"url": "https://files.pythonhosted.org/packages/91/fc/06b0c55da57910c673a2c3a60cb7ccee61d7d17482119719bfb1aa6aa954/wagtail_picture_tag-2.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b7e2c92e29e074d6c80e12920c58c56a56f4583eb51fc744606bca31884dc128",
"md5": "2daf6dba7c45aefc48ecda4c3da1e35c",
"sha256": "0cfd71d03a4b0f5b85d7b0e2fc95f4e942ca2b43f257881c5e04cd21941fa552"
},
"downloads": -1,
"filename": "wagtail-picture-tag-2.0.1.tar.gz",
"has_sig": false,
"md5_digest": "2daf6dba7c45aefc48ecda4c3da1e35c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 21319,
"upload_time": "2023-10-29T16:08:32",
"upload_time_iso_8601": "2023-10-29T16:08:32.606794Z",
"url": "https://files.pythonhosted.org/packages/b7/e2/c92e29e074d6c80e12920c58c56a56f4583eb51fc744606bca31884dc128/wagtail-picture-tag-2.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-29 16:08:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bengosney",
"github_project": "wagtail-picture-tag",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"circle": true,
"requirements": [
{
"name": "anyascii",
"specs": [
[
"==",
"0.3.2"
]
]
},
{
"name": "asgiref",
"specs": [
[
"==",
"3.7.2"
]
]
},
{
"name": "beautifulsoup4",
"specs": [
[
"==",
"4.11.2"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2023.7.22"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.3.1"
]
]
},
{
"name": "defusedxml",
"specs": [
[
"==",
"0.7.1"
]
]
},
{
"name": "django",
"specs": [
[
"==",
"4.2.6"
]
]
},
{
"name": "django-filter",
"specs": [
[
"==",
"22.1"
]
]
},
{
"name": "django-modelcluster",
"specs": [
[
"==",
"6.1"
]
]
},
{
"name": "django-permissionedforms",
"specs": [
[
"==",
"0.1"
]
]
},
{
"name": "django-taggit",
"specs": [
[
"==",
"3.1.0"
]
]
},
{
"name": "django-treebeard",
"specs": [
[
"==",
"4.7"
]
]
},
{
"name": "djangorestframework",
"specs": [
[
"==",
"3.14.0"
]
]
},
{
"name": "draftjs-exporter",
"specs": [
[
"==",
"2.1.7"
]
]
},
{
"name": "et-xmlfile",
"specs": [
[
"==",
"1.1.0"
]
]
},
{
"name": "filetype",
"specs": [
[
"==",
"1.2.0"
]
]
},
{
"name": "html5lib",
"specs": [
[
"==",
"1.1"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.4"
]
]
},
{
"name": "l18n",
"specs": [
[
"==",
"2021.3"
]
]
},
{
"name": "openpyxl",
"specs": [
[
"==",
"3.1.2"
]
]
},
{
"name": "pillow",
"specs": [
[
"==",
"10.1.0"
]
]
},
{
"name": "pytz",
"specs": [
[
"==",
"2023.3.post1"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.31.0"
]
]
},
{
"name": "six",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "soupsieve",
"specs": [
[
"==",
"2.5"
]
]
},
{
"name": "sqlparse",
"specs": [
[
"==",
"0.4.4"
]
]
},
{
"name": "telepath",
"specs": [
[
"==",
"0.3.1"
]
]
},
{
"name": "typing-extensions",
"specs": [
[
"==",
"4.8.0"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.0.7"
]
]
},
{
"name": "wagtail",
"specs": [
[
"==",
"5.0.5"
]
]
},
{
"name": "webencodings",
"specs": [
[
"==",
"0.5.1"
]
]
},
{
"name": "willow",
"specs": [
[
"==",
"1.5.1"
]
]
}
],
"lcname": "wagtail-picture-tag"
}