Debian Codegraph @

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

raw
1 ---
2 title: reflect.IsImageResourceProcessable
3 description: Reports whether the given value is a Resource object representing an image from which Hugo can extract dimensions and perform processing such as converting, resizing, cropping, or filtering.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 aliases: []
9 returnType: bool
10 signatures: [reflect.IsImageResourceProcessable INPUT]
11 ---
12
13 {{< new-in 0.157.0 />}}
14
15 {{% glossary-term "processable image" %}}
16
17 ## Usage
18
19 This example iterates through all project resources and uses `reflect.IsImageResourceProcessable` to ensure the image pipeline can perform transformations like resizing before processing begins.
20
21 ```go-html-template
22 {{ range resources.Match "**" }}
23 {{ if reflect.IsImageResourceProcessable . }}
24 {{ with .Process "resize 300x webp" }}
25 <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="Processed Image">
26 {{ end }}
27 {{ end }}
28 {{ end }}
29 ```
30
31 {{% include "/_common/functions/reflect/image-reflection-functions.md" %}}