From c2850b17ba99300a8ea17d7fb82d20c189882296 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Thu, 10 Mar 2016 12:27:44 +0100 Subject: [PATCH] Added documentation for cropping --- content/docs/api/db/record/thumbnail/contents.lr | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/content/docs/api/db/record/thumbnail/contents.lr b/content/docs/api/db/record/thumbnail/contents.lr index 78b24dfa..1979578d 100644 --- a/content/docs/api/db/record/thumbnail/contents.lr +++ b/content/docs/api/db/record/thumbnail/contents.lr @@ -4,7 +4,7 @@ summary: Creates a thumbnail for an image. --- type: method --- -signature: width, height=None +signature: width, height=None, crop=False --- body: @@ -12,6 +12,11 @@ This method is available on attachments that are images and can be used to automatically generate a thumbnail. The return value is a thumbnail proxy that can be either use directly or with the `|url` filter. +If cropping is not enabled the thumbnail is scaled down to fit into the +given reactangle of width and height. If height is not specified it will +match the width and the height is set accordingly. If cropping is enabled +it's cropped around the edges to fit into the center. + It provides the following attributes: * `width`: the thumbnail width in pixels. @@ -19,6 +24,9 @@ It provides the following attributes: * `url_path` the URL path of the thumbnail. This is absolute and needs to be made relative with the `|url` filter. +!!! Starting with Lektor 2.0 you can also pass `crop=True` to crop the image +to the exact dimensions provided instead of scaling it uncropped. + ## Example ```html+jinja