diff options
author | Sylvia <sylvie@gmail.com> | 2021-09-16 13:45:39 +0300 |
---|---|---|
committer | Karl <kc0bfv@gmail.com> | 2021-11-12 01:30:51 +0300 |
commit | e7e8e13b10c4634523b98a9912ed36bf22fcaee5 (patch) | |
tree | e0bf627b73bbe03e8f072b047d84040cfe64f4a6 | |
parent | 74b26dccda624f6678c6c941f7285184239cbce6 (diff) |
Allow to overwrite resize logic to support restriction by height (makes more sense for row based layouts).
-rw-r--r-- | layouts/partials/sect_and_img_content.html | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/layouts/partials/sect_and_img_content.html b/layouts/partials/sect_and_img_content.html index a7b995a..1449d88 100644 --- a/layouts/partials/sect_and_img_content.html +++ b/layouts/partials/sect_and_img_content.html @@ -10,8 +10,19 @@ {{- $filename_as_phototitle := default false ($.Param "filename_as_phototitle") }} {{- $downloadable := default true ($.Param "images_downloadable") }} - {{- $thumb_size := printf "%dx q%d" $thumb_width $thumb_quality }} - {{- $full_size := printf "%dx q%d" $full_width $full_quality }} + {{- /* Calculate thumb_size string from params unless a finished string is provided in the config. */}} + {{- $.Scratch.Set "thumb_size" (default "" ($.Param "thumb_size")) }} + {{ if (eq ($.Scratch.Get "thumb_size") "") }} + {{- $.Scratch.Set "thumb_size" (printf "%dx q%d" $thumb_width $thumb_quality) }} + {{ end }} + {{- $thumb_size := $.Scratch.Get "thumb_size" }} + + {{- /* Same for full_size string */}} + {{- $.Scratch.Set "full_size" (default "" ($.Param "full_size")) }} + {{ if (eq ($.Scratch.Get "full_size") "") }} + {{- $.Scratch.Set "full_size" (printf "%dx q%d" $full_width $full_quality) }} + {{ end }} + {{- $full_size := $.Scratch.Get "full_size" }} {{- /* Build the list of sections and thumbnails */}} {{- $.Scratch.Set "sections" (slice) }} |