Images from Structure Fields not loading correctly after Kirby 5 update

,

Hello everyone,

I recently updated a project from Kirby 2 to Kirby 5. Since the update, images in my template are not loading correctly — in both the frontend and the panel they appear as “broken links.” After reloading the page or the panel, they sometimes display correctly. It seems the files are only added to the Media folder after a reload.

Setup:

  • Kirby 5

  • LazySizes for lazy loading

  • Media folder permissions set to 775

  • Thumbnails generated via $img->resize(...)->url() directly in the template

  • Blueprint: Structure field containing files

  • In the frontend I use <img class="lazyload" data-srcset="..." ...>

Problem:

  • Images often only appear after multiple reloads

  • Removing LazySizes prevents the images from showing at all

Already checked:

  • Media folder permissions (775)

  • Config: 'thumbs' => ['driver' => 'gd']

  • Debug mode is enabled; no console errors

Question:
Has anyone experienced why images from structure fields sometimes don’t load in Kirby 5 or aren’t correctly saved to the Media folder? Do I need to change the template, or is there specific update behavior with LazySizes / Media folder I should be aware of?

Thanks in advance!

Are the images that finally do load properly resized?
Are you testing locally or on a remote server?
What about PHP settings like max_excution_time, memory_limit etc.?

I think the images are disapprearing when you disable LazySizes because that works by lazy loading the URL for the image set in a data atribute and dynamially adding it as the src attribute. WIthout the javascipt, those image tags do not have a valid src atribute.

I would recommend Unlazy which is more up,to date https://unlazy.byjohann.dev/

Enhancing memory_limit and max_execution_time did the trick.

Thank you very much for your fast help!

Thank you very much for your fast help.
The problem was also in the panel and I was able to solve it with PHP settings.