Setting image templates

We’ve got a files sections that should display all page images independent of their template. Thus, we don’t set any value for template in the blueprint in order to allow any template to be displayed in the list.

Questions:

  1. When uploading an image, we’d always want to set a specific template. How can we do this?
  2. When uploading an image, currently, no template is attached at all. How can we set a template later on?
2 Likes

Hm, doesn’t look as if there was an option for that. Something like upload: image has no effect.

Workaround: assign a template via hook for the moment

How would I do that in a hook?

Create a file.create:after hook and update the file using $file->update()https://getkirby.com/docs/reference/objects/file/update

1 Like

That works, thanks!