This plugin automatically generates thumbnails for any images in your Lektor content. The difference between this plugin and the `thumbnail` filter is that this is geared towards content, i.e. you don't need to have any references to the images in your templates at all.
Project description
Lektor Thumbnail Generator
This plugin automatically generates thumbnails for any images in your Lektor
content. The difference between this plugin and the thumbnail
filter is that
this is geared towards content, i.e. you don't need to have any references to
the images in your templates at all.
Usage
Use this plugin if you want to be able to link to full-size images in your
content, but still want thumbnails to be generated for the link itself. For
example, you may have an image called cat.jpg
, and to link to it in the
content (not the template), but also show a thumbnail.
You can do that like so:
<a href="cat.jpg"><img src="cat-small.jpg" /></a>
Installation
To install the plugin, just add lektor-thumbnail-generator
to your plugins
from the command line:
lektor plugins add lektor-thumbnail-generator
If you have trouble, see the plugin installation section of the Lektor documentation.
Then, create a config file called configs/thumbnail-generator.ini
and add
a few sections for images. The section names can be whatever you want, the
final images will be called imagename-sectionname.ext
. For example, this
config file:
[small]
max_width = 30
[medium]
max_width = 400
max_height = 400
[woowee]
max_width = 2000
Will take a file called cat.jpg
and create the files cat-small.jpg
,
cat-medium.jpg
and cat-woowee.jpg
. All the files will be created, regardless
of whether the original file is smaller, so you can link without worrying
whether a file will exist or not. If the original file is smaller than the width
you have specified, the file will only be copied, and will not be resized.
The max_width
/max_height
parameters work like for the Lektor
thumbnail command.
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
File details
Details for the file lektor-thumbnail-generator-0.4.0.tar.gz
.
File metadata
- Download URL: lektor-thumbnail-generator-0.4.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d48aede066233992007de9308ad7af5ed7e45b70ba1ad80574f9a94a0b8e9c7 |
|
MD5 | da20c1ed2707d9ef777f5fba38338ed0 |
|
BLAKE2b-256 | 86060e300f3e1ce5dcf4ef544de55346601a287f4001d6f9dc95af9f0811adad |
File details
Details for the file lektor_thumbnail_generator-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: lektor_thumbnail_generator-0.4.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31ba056eae20a56fd7843d5ff5a2e61b57953b618e47fb59c7e5c8fe324e191e |
|
MD5 | d3fec5c069f1d5524670da196548ef5e |
|
BLAKE2b-256 | 1054df9bd500c110f97f01a817c00fa08df6356fdb5684468b858b10bc7fee99 |