How are srcsets generated/Where are the settings?

I see that without any plugin after uploading an image to a page, that within the REST API I get a srcset for this image:

"srcset": "http:\/\/cms.cda.test\/media\/pages\/home\/2744598729-1583104264\/img-4166rrr-352x.jpg 352w, http:\/\/cms.cda.test\/media\/pages\/home\/2744598729-1583104264\/img-4166rrr-864x.jpg 864w, http:\/\/cms.cda.test\/media\/pages\/home\/2744598729-1583104264\/img-4166rrr-1408x.jpg 1408w"

I asked myself where are the settings for these sizes saved and how can I edit them?
352px, 864px and 1408px…

I search the repo on github and found this:

This tells me that whenever I have a card layout for my images that I get these three sizes saved.
That also makes sense why I don’t have these sizes for all of my images.

What I now need is the generation of custom sizes on upload, because I can’t use src-set kirbytags in my headless setup. So how can I trigger resizing on upload and afterwards having access to these files via REST API?

It would be crucial for me to have control over image sizes.

Thank you in advance.
cheers

srcset presets are defined here:

somethink like this will only work on upload

there are scripts in the forum how to apply that to all site.index.images() if you need to recreate thumbs for uploaded images.

also consider this plugin for kirby as headless

Thank you for your help.

I think that is indeed what I need. The resizing on upload.

I already have better-rest in use, but I don’t see no effect.
But I did search a bit in the source code of better-rest and realized that he just creates new endpoints where ->resize() is used. So I am currently building my own endpoint with custom resizes, which should work as well.

Anyway the creation on upload is supercool.
I will see if it works for me.
Thank you.

betterest will not create the thumbs. i just mentioned it since i consider it helpful for headless. but glad that you already use it.