Skip to main content

A configurable way to generate thumbnails.

Project description

lektor image resize plugin

PyPI version Downloads Linting Python package Upload Python Package

This plugin automatically generates thumbnails for any images in your Lektor content. The difference between this plugin and the lektor thumbnail filter is that this plugin is converting all images and you don't need to have any references to the images in your templates.

TL;DR: What does this plugin do?

  • It will generate JPEG images in the sizes you configured of all images in your Lektor content.

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 waffle.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="waffle.jpg"><img src="waffle-small.jpg" /></a>

Installation

To install the plugin, just add lektor-image-resize to your plugins from the command line:

lektor plugins add lektor-image-resize

If you have trouble, see the plugin installation section of the Lektor documentation.

Then, create a config file called configs/image-resize.ini and add a few sections for images. The section names can be whatever you want, the final images will be called imagename-sectionname.jpg. For example, this config file:

[small]
max_width = 256

[medium]
max_width = 800
max_height = 800

[woowee]
max_width = 2000

Will take a file called waffle.jpg and create the files waffle-small.jpg, waffle-medium.jpg and waffle-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-image-resize-0.4.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

lektor_image_resize-0.4.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file lektor-image-resize-0.4.0.tar.gz.

File metadata

  • Download URL: lektor-image-resize-0.4.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for lektor-image-resize-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7e47035a2fa5e2cac283e961c6e447af4e0b61694544154bbd0b2c8c2ab05945
MD5 21802a30cab33099ee66fd5f52e0c840
BLAKE2b-256 92b6ddc155c6738374f72559c380825d89d6730aa06fcb96b82d66d1cee306ff

See more details on using hashes here.

File details

Details for the file lektor_image_resize-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: lektor_image_resize-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for lektor_image_resize-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 848cecbebdc3e3cb427d2f7c7ee47b6a0bab4d9dfdd1631b1033566e0670a8aa
MD5 9bc4839a4b9be0ed70c913d5602331f9
BLAKE2b-256 7f9e0e6f23d8c8403b81b60caa871e14519e3a7449c4531b1143778b2edcf246

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