Wen Junhua 2023-12-13 21:59:15 +01:00 committed by GitHub
commit d7359f99f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 56 additions and 23 deletions

View File

@ -81,6 +81,11 @@
type="image/webp" type="image/webp"
/> />
{{ end }} {{ end }}
{{ $orientation := 1 }}
{{ with .Exif }}
{{ $orientation = .Tags.Orientation }}
{{ end }}
{{ if eq $orientation 1 }}
<img <img
src="{{ .RelPermalink }}" src="{{ .RelPermalink }}"
width="{{ $width }}" width="{{ $width }}"
@ -107,6 +112,34 @@
src="{{ (.Resize "660x").RelPermalink }}" src="{{ (.Resize "660x").RelPermalink }}"
{{ end }} {{ end }}
> >
{{ else if (eq $orientation 8) }}
<img
src="{{ (.Resize "r90").RelPermalink }}"
width="{{ $width }}"
height="{{ $height }}"
{{ with $class }} class="{{ . }}" {{ end }}
{{ with $alt }} alt="{{ . }}" {{ end }}
{{ with $lazy }} loading="lazy" decoding="async" {{ end }}
{{ if lt .Width 660 }}
src="{{ .RelPermalink }}"
{{ else }}
srcset="
{{- (.Resize "330x r90").RelPermalink }} 330w,
{{- (.Resize "660x r90").RelPermalink }} 660w
{{ if gt .Width 1024 }}
,{{ (.Resize "1024x r90").RelPermalink }} 1024w
{{ else }}
,{{ .RelPermalink }} {{ .Width }}w
{{ end }}
{{ if gt .Width 1320 }}
,{{ (.Resize "1320x r90").RelPermalink }} 2x
{{ else }}
,{{ .RelPermalink }} {{ .Width }}w
{{ end }}"
src="{{ (.Resize "660x r90").RelPermalink }}"
{{ end }}
>
{{ end }}
</picture> </picture>
{{ end }} {{ end }}
{{ end }} {{ end }}