Skip to content

Commit

Permalink
Allow the original or full image to be used as the thumbnail when thu…
Browse files Browse the repository at this point in the history
…mbnailResizeOptions is set to 'original' or 'full' (feature #77)
  • Loading branch information
mfg92 committed Jun 28, 2024
1 parent a330442 commit 0152e96
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions layouts/shortcodes/gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@
if the EXIF informations contains an orientation value. See issue #22. */}}
{{ $rotated := $original.Filter images.AutoOrient }}

{{/* Create thumbnail, rotate it if needed */}}
{{ $thumbnail := ($rotated.Fit $thumbnailResizeOptions) }}


<div>
{{ $full := "" }}
{{ if $imageResizeOptions }}
Expand All @@ -130,6 +126,19 @@
{{/* No need to use the rotated here, the browser will handle care of EXIF orientation */}}
{{ $full = $original }}
{{ end }}

{{ $thumbnail := "" }}
{{ if eq $thumbnailResizeOptions "original" }}
{{/* If thumbnailResizeOptions is set to 'original', use the original (unmodified) image for the thumbnail */}}
{{ $thumbnail = $original }}
{{ else if eq $thumbnailResizeOptions "full" }}
{{/* If thumbnailResizeOptions is set to 'full', use the same image as the lightbox for the thumbnail */}}
{{ $thumbnail = $full }}
{{ else }}
{{/* Create thumbnail, rotate it if needed */}}
{{ $thumbnail = ($rotated.Fit $thumbnailResizeOptions) }}
{{ end }}

<a href="{{ $full.RelPermalink }}"
class="galleryImg"
{{ with $metadata }}
Expand Down

0 comments on commit 0152e96

Please sign in to comment.