pelican-advthumbnailer
A thumbnail generator for Pelican that automatically scans all image tags looking for missing images and creates the thumbnails based on the filename.
Based on the existing thumbnailer plugin.
Install
To install the library, you can use pip
$ pip install pelican-advthumbnailer
Usage
Update pelicanconf.py:
Add advthumbnailer to PLUGINS.
You should add it before any image optimization plugins.
PLUGINS = [..., 'advthumbnailer']
Creating a thumbnail:
Ensure original image is copied to the output folder (add to STATIC_PATHS or use the autostatic plugin).
E.g: output/images/example.png
Add an <img> (or a <source> tag) containing as source (or scrset):
images/thumbnails/<spec>/example.png
Where <spec> is one of the following:
<number>: Perform a square resize of the image to <number>x<number> pixels.
<number1>x<number2>: Perform a scale and crop resize of the image to <number1>x<number2> pixels.
<number1>x_ or _x<number2>: Perform an aspect-preserving resize of the image enforcing the specified with or height, respectively, in pixels.
<spec> can also be terminated with a ! in which case upscales (e.g: resize 100px to 200px) will also be allowed. By default this is not the case.
Example:
<img src="images/thumbnails/100x_/example.png" />Upon output generation, all files are scanned for image sources and those matching the .*thumbnails/<spec>/.+ regex are thumbnailed according to the <spec>.
Options
ADVTHUMB_SEARCH_IMAGES_IN_ANCHORS (default: False): Boolean option that determines if advthumbnailer should consider the href attribute of <a> elements as thumbnail paths.
ADVTHUMB_QUALITY (default: 70): Int option that determines quality of generated thumbnails.
ADVTHUMB_OPTIMIZE (default: True): Boolean option that determines if generated thumbnails should be optimized.
ADVTHUMB_PROGRESSIVE (default: True): Boolean option that determines if generated thumbnails should be progressive.
Integrations
pelican-autostatic
Integration with pelican-autostatic is achieved by adding an option to the {static ...} replacement.
{static images/example.png thumb="100x_"}
Jinja2
Integration with Jinja2 is achieved via the thumbnail function.
<img src="{{ SITEURL + "images/example.png" | thumbnail("100x_") }}" />
Example usage
For a working example check my site and my site’s source code.
Metadata
Release files for pelican-advthumbnailer 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pelican-advthumbnailer-1.0.0.tar.gz | 9.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pelican_advthumbnailer-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.9 kB
Release files / pelican-advthumbnailer-1.0.0.tar.gz
| Download URL | pelican-advthumbnailer-1.0.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
815a2d7c9cb90fc5133b8a0846ca413dae984b6a51642114290032c0009840f1
|
|
BLAKE2b-256 checksum How to use checksums |
90652c3045436f23ce2d55452f5d511f94692b3ec1fea0fbf1d487b1f1e960ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
|
Release files / pelican_advthumbnailer-1.0.0-py3-none-any.whl
| Download URL | pelican_advthumbnailer-1.0.0-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0848cb4f02b55840e50caa9fd97a35e1e38ea468f175d05675833bdb5beeedb5
|
|
BLAKE2b-256 checksum How to use checksums |
2ba54c5404812a85ae8f30f3b61ca1ca2fbf50f7a37f5a5f0861e5d1ea82b7e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
|
Security for pelican-advthumbnailer 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.