Debian Codegraph @

docs/content/en/methods/resource/Height.md

raw
1 ---
2 title: Height
3 description: Returns the height of the given image resource.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: int
9 signatures: [RESOURCE.Height]
10 ---
11
12 {{% include "/_common/methods/resource/global-page-remote-resources.md" %}}
13
14 Use the [`reflect.IsImageResourceWithMeta`][] function to verify that Hugo can determine the dimensions before calling the `Height` method.
15
16 ```go-html-template
17 {{ with resources.GetMatch "images/featured.*" }}
18 {{ if reflect.IsImageResourceWithMeta . }}
19 <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
20 {{ else }}
21 <img src="{{ .RelPermalink }}" alt="">
22 {{ end }}
23 {{ end }}
24 ```
25
26 [`reflect.IsImageResourceWithMeta`]: /functions/reflect/isimageresourcewithmeta/