mirror of https://github.com/jpanther/congo.git
Compare commits
1 Commits
7e3a4a92f8
...
cf09f3adf9
Author | SHA1 | Date |
---|---|---|
Wen Junhua | cf09f3adf9 |
|
@ -81,64 +81,66 @@
|
|||
type="image/webp"
|
||||
/>
|
||||
{{ end }}
|
||||
{{ $orientation := 1 }}
|
||||
{{ with .Exif }}
|
||||
{{ $orientation = .Tags.Orientation }}
|
||||
{{ end }}
|
||||
{{ if eq $orientation 1 }}
|
||||
<img
|
||||
src="{{ .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").RelPermalink }} 330w,
|
||||
{{- (.Resize "660x").RelPermalink }} 660w
|
||||
{{ if gt .Width 1024 }}
|
||||
,{{ (.Resize "1024x").RelPermalink }} 1024w
|
||||
{{ else }}
|
||||
,{{ .RelPermalink }} {{ .Width }}w
|
||||
{{ end }}
|
||||
{{ if gt .Width 1320 }}
|
||||
,{{ (.Resize "1320x").RelPermalink }} 2x
|
||||
{{ else }}
|
||||
,{{ .RelPermalink }} {{ .Width }}w
|
||||
{{ end }}"
|
||||
src="{{ (.Resize "660x").RelPermalink }}"
|
||||
{{ with $img }}
|
||||
{{ $orientation := 1 }}
|
||||
{{ with .Exif }}
|
||||
{{ $orientation = .Tags.Orientation }}
|
||||
{{ 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 }}
|
||||
{{ if eq $orientation 1 }}
|
||||
<img
|
||||
src="{{ .RelPermalink }}"
|
||||
{{ else }}
|
||||
srcset="
|
||||
{{- (.Resize "330x r90").RelPermalink }} 330w,
|
||||
{{- (.Resize "660x r90").RelPermalink }} 660w
|
||||
{{ if gt .Width 1024 }}
|
||||
,{{ (.Resize "1024x r90").RelPermalink }} 1024w
|
||||
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 }}
|
||||
,{{ .RelPermalink }} {{ .Width }}w
|
||||
srcset="
|
||||
{{- (.Resize "330x").RelPermalink }} 330w,
|
||||
{{- (.Resize "660x").RelPermalink }} 660w
|
||||
{{ if gt .Width 1024 }}
|
||||
,{{ (.Resize "1024x").RelPermalink }} 1024w
|
||||
{{ else }}
|
||||
,{{ .RelPermalink }} {{ .Width }}w
|
||||
{{ end }}
|
||||
{{ if gt .Width 1320 }}
|
||||
,{{ (.Resize "1320x").RelPermalink }} 2x
|
||||
{{ else }}
|
||||
,{{ .RelPermalink }} {{ .Width }}w
|
||||
{{ end }}"
|
||||
src="{{ (.Resize "660x").RelPermalink }}"
|
||||
{{ end }}
|
||||
{{ if gt .Width 1320 }}
|
||||
,{{ (.Resize "1320x r90").RelPermalink }} 2x
|
||||
>
|
||||
{{ 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 }}
|
||||
,{{ .RelPermalink }} {{ .Width }}w
|
||||
{{ end }}"
|
||||
src="{{ (.Resize "660x r90").RelPermalink }}"
|
||||
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 }}
|
||||
>
|
||||
{{ end }}
|
||||
</picture>
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in New Issue