fix: author image stretch when zooming

fix this issue by using square image for data-zoom-src
This commit is contained in:
ZhenShuo Leo
2025-11-22 04:56:21 +08:00
parent c9595934ea
commit 8d5c2045a6
5 changed files with 25 additions and 7 deletions
+4 -1
View File
@@ -9,15 +9,18 @@
{{ end }}
{{ if $authorImage }}
{{ $final := $authorImage }}
{{ $squareImage := $authorImage }}
{{ if not $disableImageOptimization }}
{{ $final = $authorImage.Fill "192x192" }}
{{ $shortSide := int (math.Min $authorImage.Width $authorImage.Height) }}
{{ $squareImage = $authorImage.Crop (printf "%dx%d" $shortSide $shortSide ) }}
{{ end }}
<img
class="!mt-0 !mb-0 h-24 w-24 rounded-full me-4"
width="96"
height="96"
src="{{ $final.RelPermalink }}"
data-zoom-src="{{ $authorImage.RelPermalink }}">
data-zoom-src="{{ $squareImage.RelPermalink }}">
{{ end }}
{{ end }}
<div class="place-self-center">