Files
2026-07-13 11:58:46 +08:00

951 B

title, description, categories, keywords, params
title description categories keywords params
reflect.IsImageResourceWithMeta 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.
functions_and_methods
aliases returnType signatures
bool
reflect.IsImageResourceWithMeta INPUT

{{< new-in 0.157.0 />}}

Usage

This example iterates through all project resources and uses reflect.IsImageResourceWithMeta to safely display image dimensions and metadata only for supported formats.

{{ range resources.Match "**" }}
  {{ if reflect.IsImageResourceWithMeta . }}
    <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="Image with Meta">
    {{ with .Meta }}
      <p>Taken on: {{ .Date }}</p>
    {{ end }}
  {{ end }}
{{ end }}

{{% include "/_common/functions/reflect/image-reflection-functions.md" %}}