Arif
1
How do I print out the width and height of the image below with .Fill
? I want the result to be {{- $img := .Fill "wxh TopLeft" }}
{{- with or (.Resources.GetMatch "featured.*") (resources.Get "image/featured.jpg") }}
{{- $w := div .Width 2 }}
{{- $h := div .Height 2 }}
....
{{- end }}
{{- with or (.Resources.GetMatch "featured.*") (resources.Get "image/featured.jpg") }}
{{- with .Fill (printf "%dx%d TopLeft" (div .Width 2) (div .Height 2)) }}
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
{{- end }}
{{- end }}
1 Like
Arif
3
So, here is where I was making a mistake. I tried both %s
and %q
from my previous use in other templates and it threw an error.
system
Closed
4
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.