Debian Codegraph @

docs/content/en/functions/reflect/IsImageResourceWithMeta.md

raw
1 ---
2 title: reflect.IsImageResourceWithMeta
3 description: Reports whether the given value is a Resource object representing an image from which Hugo can extract dimensions and, if present, Exif, IPTC, and XMP data.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 aliases: []
9 returnType: bool
10 signatures: [reflect.IsImageResourceWithMeta INPUT]
11 ---
12
13 {{< new-in 0.157.0 />}}
14
15 ## Usage
16
17 This example iterates through all project resources and uses `reflect.IsImageResourceWithMeta` to safely display image dimensions and metadata only for supported formats.
18
19 ```go-html-template
20 {{ range resources.Match "**" }}
21 {{ if reflect.IsImageResourceWithMeta . }}
22 <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="Image with Meta">
23 {{ with .Meta }}
24 <p>Taken on: {{ .Date }}</p>
25 {{ end }}
26 {{ end }}
27 {{ end }}
28 ```
29
30 {{% include "/_common/functions/reflect/image-reflection-functions.md" %}}