Access resized image file names externally

Is there any way to access the file names of resized image resources externally, i.e. in some other process than hugo?

I’d like to use the resized image files from a Python script, but there doesn’t seem to be a way to know what they are?

I’m looking at having Hugo write them to a JSON file as an output format, but I’d like to know if there’s an easier way.

There is no practical way, no.

This turned out to be easy to do using a JSON output format.

The JSON template contains the desired resized image URL and whatever else is required:

{
  "title": "{{ .Title }}",

  {{ $resource := .Resources.GetMatch "image" }}
  {{ $image := $resource.Resize "256x" }}
  "imageUrl": "{{ $image.Permalink }}"
}

Then the external process can consume the JSON files.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.