From d225da3941975434c281bf382ef8d7d6aa5c24ae Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Mon, 27 Nov 2023 23:42:08 +0800 Subject: [PATCH 1/2] fix: add image fix --- layouts/partials/picture.html | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/layouts/partials/picture.html b/layouts/partials/picture.html index 752f84a88..6a9159641 100644 --- a/layouts/partials/picture.html +++ b/layouts/partials/picture.html @@ -81,6 +81,12 @@ type="image/webp" /> {{ end }} + {{ with $img }} + {{ $orientation := 1 }} + {{ with .Exif }} + {{ $orientation = .Tags.Orientation }} + {{ end }} + {{ if eq $orientation 1 }} + {{ else if (eq $orientation 8) }} + {{ . }} + {{ end }} + {{ end }} {{ end }} {{ end }} \ No newline at end of file From 1b7361c50db31f2e601aad787254e386a7bf0e1e Mon Sep 17 00:00:00 2001 From: Wen Junhua Date: Tue, 28 Nov 2023 21:16:27 +0800 Subject: [PATCH 2/2] fix: remove redundant tags --- layouts/partials/picture.html | 106 +++++++++++++++++----------------- 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/layouts/partials/picture.html b/layouts/partials/picture.html index 6a9159641..9f15926ef 100644 --- a/layouts/partials/picture.html +++ b/layouts/partials/picture.html @@ -81,66 +81,64 @@ type="image/webp" /> {{ end }} - {{ with $img }} - {{ $orientation := 1 }} - {{ with .Exif }} - {{ $orientation = .Tags.Orientation }} - {{ end }} - {{ if eq $orientation 1 }} - {{ . }} - {{ else if (eq $orientation 8) }} - {{ . }} + {{ else if (eq $orientation 8) }} + {{ . }} + {{ if gt .Width 1320 }} + ,{{ (.Resize "1320x r90").RelPermalink }} 2x + {{ else }} + ,{{ .RelPermalink }} {{ .Width }}w + {{ end }}" + src="{{ (.Resize "660x r90").RelPermalink }}" {{ end }} + > {{ end }} {{ end }}