A Wagtail app to add a picture tag.
Project description
Wagtail Picture Tag adds a picture template tag. It takes a the same parameters as the Wagtail Image tag but it can accept multiple size and format parameters.
By default it will try and create JPEG, PNG, JPEG and AVIF (if available). There are also two formate shortcuts:
photo - will create JPEG, WEBP and AVIF
transparent - will create WEBP, PNG and 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
Install the package:
pip install wagtail-picture-tag
Add “wagtail-picture-tag” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'wagtail_picture_tag', ]
Include the tag in your template:
{% load picture_tags %}
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
Testing is done with pytest. Install and test can be done with:
pip install -r requirements.txt -r requirements.dev.txt pytest
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for wagtail-picture-tag-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff4b79a9e6af0c645acb274642e4cd1917ace6f9d71988c7b8b7499fa760d8fa |
|
MD5 | 5dd79e61d28e5aa1592dcb22765384c4 |
|
BLAKE2b-256 | 2c8614c11610433f67fa2f5194a1532802e7bb0e911aa4d15f0e26826ec4b8fa |
Hashes for wagtail_picture_tag-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d3f29fa3460b4cbe6e2cd96db5a247698b71c6945ba1ece85fd2ef2d3b67471 |
|
MD5 | 0261e0519b6c00c44124e36475718c7a |
|
BLAKE2b-256 | b0be796bac2c841ab07dabbf966fdb82a0e293f526a1ba37a281baa471b142e6 |