ImageOptim as Kirby Thumb

Can the thumb function be modified to use the ImageOptim API?

It would be ideal to only have to set c::set('imageOptim.username', 'abcdef123566'); in the config.php and then the thumbnails aren’t generated on the own server anymore but over the ImageOptim API.

You can probably just use a function that returns the required URL, in the same way Kirby used imgix to generate thumbnails on the fly:

Yes, that would be an option for the “on the fly” method. I would however
like to overwrite the thumb function if that is possible to actually store
the image on my own server

You can replace the thumb class with your own component: https://getkirby.com/docs/developer-guide/plugins/components

That is exactly what I was looking for, thank you @texnixe!