Thumbnails broken on first load

Hi!

I have the problem, that when I open a page containing thumbs the first time, the “broken image” icon is displayed instead of the thumbs. However, according to DevTools the images’ response code is a normal 200. From the second time I load the page onward all thumbs are loaded correctly.

In https://getkirby.com/docs/guide/templates/resize-images-on-the-fly you state that “thumbs are generated asynchronously”. What does this mean? And could this be the reason for the error?

This has very bad side effects, e.g. when browsing through our image galleries the first user who ever opens a lightbox-gallery needs to click through all photos, getting the “broken image” icon for every single one before he can start from the beginning of the gallery again - then with the working photos.

How can I trigger that all thumbs for the entire site are generated right after new images are uploaded?

Oh sorry, I started to write an answer but it was never finished. I have no idea what could be causing this and have never experienced it myself. How about using @bnomei’s Janitor plugin to pre-generate all thumbs?

@mshoestrng Does this also happen with a fresh Starterkit?

I had this issue and I finally found that the cause was an empty first line in an index.php file in a custom plugin… :roll_eyes:

We had the same issue and used this regular expression to search all our files:

^[\r\n]+[\t ]*<\?

The whitespace doesn’t have to be in a plugin, having an extra line in a template or snippet causes this as well.

2 Likes