Resources.GetMatch and imageConfig


I am using Page Resources to get the images for each page. I am using a wildcard with Resources.GetMatch to get the first image returned. I am now trying to implement responsive images and imageConfig requires that I know the complete filename. I’ve read a bunch of docs/websites about page resources but I’ve yet to work out how to get the full filename of the file so I can pass it to imageConfig.

Is it possible to get the filename of a file found by Resources.GetMatch?

I’ve worked this out on my own. It seems I can get the same data available with imageConfig as I can from the image returned from Page Resources.

			{{ $img_search_path := "images/hero*.*" }}

			{{ $img := .Resources.GetMatch $img_search_path }}

			{{ $img.Height }} {{ $img.Width }}
1 Like