This is the same issue as in posts:
Kirby 3.5, PHP7.3-FPM, Apache 2.4.25 on Debian
$asset = new asset('file.jpg');
$thumb = $asset->thumb(array('width' => 250));
then I use $thumb->url() inside an image tag src attribute.
Now all seems ok, the generated code is correct, but the thumb isn’t loaded the first time the page loads, even though web inspector shows a HTTP200 status code for the thumb. Only after a page refresh it is loaded. On hovering over the source in web inspector, it prints ‘could not load the image’.
The thumb has an img src pointing to the media/assets/ folder, where it is put by Kirby after creation. Possibly the page is requesting the image before it is ready? This also explains why it is actually found after a reload.
Since literally thousands of crude image files need to be resized on the fly, I’m pretty much stuck.