aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/author-picture.html
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-06-11 23:15:33 -0400
committertdro <tdro@noreply.example.com>2022-06-11 23:15:33 -0400
commitea9c7faaaa82401bc8e32efd40c353a2696ac0b9 (patch)
treedb17f9cd7d6b720d3ea86a2afd76a6253de307e4 /themes/default/layouts/partials/author-picture.html
parented5ac80fac302574d5643bf6f69066805d520075 (diff)
downloadcanory-ea9c7faaaa82401bc8e32efd40c353a2696ac0b9.tar.gz
canory-ea9c7faaaa82401bc8e32efd40c353a2696ac0b9.tar.bz2
canory-ea9c7faaaa82401bc8e32efd40c353a2696ac0b9.zip
themes/default/layouts: Try fit instead of resize
Default to webp, and use fit method. Might produce better image rendering overall.
Diffstat (limited to 'themes/default/layouts/partials/author-picture.html')
-rw-r--r--themes/default/layouts/partials/author-picture.html17
1 files changed, 8 insertions, 9 deletions
diff --git a/themes/default/layouts/partials/author-picture.html b/themes/default/layouts/partials/author-picture.html
index f0a0849..e583233 100644
--- a/themes/default/layouts/partials/author-picture.html
+++ b/themes/default/layouts/partials/author-picture.html
@@ -1,16 +1,15 @@
-{{- $file := "/profile/picture.png" -}}
-{{- $path := print "public/" (partial "author-media-path.html" .) $file -}}
-{{- $image := resources.Get $path -}}
-{{- $404origin := print "/images/404.png" -}}
-{{- $404image := imageConfig (print "static/" $404origin) -}}
+{{- $file := "/profile/picture.png" -}}
+{{- $path := print "public/" (partial "author-media-path.html" .) $file -}}
+{{- $image := resources.Get $path -}}
+{{- $404origin := print "/images/404.png" -}}
+{{- $404image := imageConfig (print "static/" $404origin) -}}
+{{- $dimensions := "96x96" -}}
{{- with .Params.feed -}}
{{- else -}}
{{- with $image -}}
{{- $image = .Content | resources.FromString (print "/data/static/images/" ($image | urlize)) -}}
- <source srcset="{{- ($image.Resize "x120 png").RelPermalink -}}" type="image/png" />
- <source srcset="{{- ($image.Resize "x120 jpg").RelPermalink -}}" type="image/jpeg" />
- <source srcset="{{- ($image.Resize "x120 webp").RelPermalink -}}" type="image/webp" />
+ <source srcset="{{- ($image.Fit (print $dimensions " webp")).RelPermalink -}}" type="image/webp" />
{{- end -}}
{{ end }}
@@ -24,7 +23,7 @@
{{ else }}
{{ if fileExists $path }}
{{- with $image -}}
- {{- $image = (.Content | resources.FromString (print "/data/static/images/" ($image | urlize))).Resize "x120" -}}
+ {{- $image = (.Content | resources.FromString (print "/data/static/images/" ($image | urlize))).Fit $dimensions -}}
width="{{ $image.Width }}"
height="{{ $image.Height }}"
src="{{ $image.RelPermalink }}"