Use AutoOrient filter when resizing images

This commit is contained in:
Edgaras Ausvicas 2024-05-08 17:38:59 +02:00
parent 7d634c9ac9
commit 347a3630f1
8 changed files with 45 additions and 9 deletions

View file

@ -24,7 +24,11 @@
<div class="w-full thumbnail_card_related nozoom" style="background-image:url({{ .RelPermalink }});"></div> <div class="w-full thumbnail_card_related nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ with .Resize "600x" }} {{ $filters := slice
images.AutoOrient
(images.Process "resize 600x")
}}
{{ with images.Filter $filters . }}
<div class="w-full thumbnail_card_related nozoom" style="background-image:url({{ .RelPermalink }});"></div> <div class="w-full thumbnail_card_related nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }} {{ end }}
{{ end }} {{ end }}

View file

@ -25,7 +25,11 @@
<div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div> <div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ with .Resize "600x" }} {{ $filters := slice
images.AutoOrient
(images.Process "resize 600x")
}}
{{ with images.Filter $filters . }}
<div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div> <div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }} {{ end }}
{{ end }} {{ end }}

View file

@ -52,7 +52,11 @@
<div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div> <div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ with .Resize "600x" }} {{ $filters := slice
images.AutoOrient
(images.Process "resize 600x")
}}
{{ with images.Filter $filters . }}
<div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div> <div class="{{ $articleImageClasses }}" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }} {{ end }}
{{ end }} {{ end }}

View file

@ -41,7 +41,11 @@
style="background-image:url({{ .RelPermalink }});"> style="background-image:url({{ .RelPermalink }});">
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ with .Resize "1200x" }} {{ $filters := slice
images.AutoOrient
(images.Process "resize 1200x")
}}
{{ with images.Filter $filters . }}
<div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom" <div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom"
style="background-image:url({{ .RelPermalink }});"> style="background-image:url({{ .RelPermalink }});">
{{ end }} {{ end }}

View file

@ -26,7 +26,11 @@
<div class="w-full h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div> <div class="w-full h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ with .Resize "1200x" }} {{ $filters := slice
images.AutoOrient
(images.Process "resize 1200x")
}}
{{ with images.Filter $filters . }}
<div class="w-full h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div> <div class="w-full h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }} {{ end }}
{{ end }} {{ end }}

View file

@ -48,7 +48,11 @@
</figure> </figure>
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ with .Resize "1200x" }} {{ $filters := slice
images.AutoOrient
(images.Process "resize 1200x")
}}
{{ with images.Filter $filters . }}
<figure> <figure>
<img class="w-full rounded-lg single_hero_round nozoom" alt="{{ $alt }}" width="{{ .Width }}" height="{{ .Height }}" src="{{ .RelPermalink }}"> <img class="w-full rounded-lg single_hero_round nozoom" alt="{{ $alt }}" width="{{ .Width }}" height="{{ .Height }}" src="{{ .RelPermalink }}">
{{ if $caption }} {{ if $caption }}

View file

@ -25,7 +25,11 @@
<div class="w-full rounded-md h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div> <div class="w-full rounded-md h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ with .Resize "1200x" }} {{ $filters := slice
images.AutoOrient
(images.Process "resize 1200x")
}}
{{ with images.Filter $filters . }}
<div class="w-full rounded-md h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div> <div class="w-full rounded-md h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }} {{ end }}
{{ end }} {{ end }}
@ -44,7 +48,11 @@
</div> </div>
</div>{{ end }} </div>{{ end }}
{{ else }} {{ else }}
{{ with .Resize "1200x" }} {{ $filters := slice
images.AutoOrient
(images.Process "resize 1200x")
}}
{{ with images.Filter $filters . }}
<div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom" <div class="fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom"
style="background-image:url({{ .RelPermalink }});"> style="background-image:url({{ .RelPermalink }});">
<div class="absolute inset-0 bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal"> <div class="absolute inset-0 bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal">

View file

@ -17,7 +17,11 @@
<div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div> <div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ with .Resize "600x" }} {{ $filters := slice
images.AutoOrient
(images.Process "resize 600x")
}}
{{ with images.Filter $filters . }}
<div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div> <div class="w-full thumbnail_card nozoom" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }} {{ end }}
{{ end }} {{ end }}