Skip to main content

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

lektor-thumbnail-generator-0.5.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file lektor-thumbnail-generator-0.5.0.tar.gz.

File metadata

  • Download URL: lektor-thumbnail-generator-0.5.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for lektor-thumbnail-generator-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ae6de504ebb29dee6b641f9ff58b79fcda432b74b651310694b67e6c4e57e6da
MD5 731ee7bae3b43bbe7594b9d7e8b1005a
BLAKE2b-256 5d726e826839355e5a3d6f0d57bd1a3a5fbe28936a049b7705ffc4aae6540f0f

See more details on using hashes here.

File details

Details for the file lektor_thumbnail_generator-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: lektor_thumbnail_generator-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for lektor_thumbnail_generator-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 994573e2c6adf1f39a9adbb77f06bfe13b347555cf7171c70fb99f0466b788bd
MD5 9cbff33664b54d65ffb251ae60260c04
BLAKE2b-256 ad9f7c147c017b0ad9ab6925db7555e07f08176ec712f0f46ff580563dbefb69

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page