Skip to main content

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.

Release files for lektor-thumbnail-generator 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lektor-thumbnail-generator 0.6.0
File Size Uploaded
lektor_thumbnail_generator-0.6.0.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lektor-thumbnail-generator 0.6.0
File Interpreter ABI Platform
lektor_thumbnail_generator-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.6 kB

Release files / lektor_thumbnail_generator-0.6.0.tar.gz

Download URL lektor_thumbnail_generator-0.6.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
82caeac5f20bcc1b0110022e8bf64973bff173b6b99ec1706dfa23d210c42ad5
BLAKE2b-256 checksum
How to use checksums
3b91fa85faa2804ba73fa61ad1ced5115b72620dc879c006233a5d0ae4fc1134
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / lektor_thumbnail_generator-0.6.0-py3-none-any.whl

Download URL lektor_thumbnail_generator-0.6.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8092b03af5d168c815cb4aad5ebf39343a9dff9e1b7f08e9d532c297e2b96606
BLAKE2b-256 checksum
How to use checksums
c0f73ccaafdc8ab686f7968799d76a8db901b3f8fcfbdb7a45795381c1f2dc39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3

2 release files

0.2

1 release file

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page