Problem with Image cache

I have a question, my site has a weird behavior regarding cache images, as the first load images are not being displayed, after that the images seem to be cached and displayed as expected. It means once I update an image to the site, I have to go myself and open all the pages, so Kirby can cache them (?)

Is it some know behavior? do I need some plugin to “pre-cache” the images? or my Kirby might be corrupted?

1 Like

There was a similar question asked a few days ago - I don’t suppose you are running it on Nginx? A fix was suggested but not yet confirmed that it helped.

In general, it’s a good idea to check that all the files were successfully transferred to the server, file and folder permissions are correct and its best to use PHP 7.1+

It’s required to use PHP 7.1+.

Kirby doesn’t cache images, images are published/created in the media folder on the fly when their URL is called in the browser.

You don’t need a plugin or anything else.

Where is that happening, on your local dev system or on a remote server? Could you please provide more information about your environment?

I do have all the requirements but still, anyways thanks for pointed that out, I will follow up the thread.

@texnixe, I am using 7.2.10, using the latest MAMP version, I haven’t done anything special. should I be using a different program? It happens on both (remote and local dev) :frowning:

I’m using Mamp myself and haven’t experienced this yet, but we have the same issue here reported here:

I currently have no idea what might be the issue, but wondering if it is some server setting.

I have the images as background image, would it be the issue? these image are been request/loaded by css.

If you delete the media folder, the correct images is actualized ? The page show the images on the first load ?

Theo, no, still same behavior:confused:
I deleted the media folder, and I re-upload the images, but the first load still the same behavior. I am not sure what it is causing it.

Are your images very big?

Also have you set a new thumb driver like Image Magik? I think GD is the default. Maybe its out of date or something. Is your server up to date in general, besides PHP?

I’m asking you the question, because as @jimbobrjames pointed out, I see similarity to my problem.

I myself have to load each page to build correctly media cache to be visible and in your case updated. As if there was a bug on the generation on the fly with a delay for the first load, remains to know what causes this problem.

I don’t have the technics level for this problem, but i would like know if it’s caused by Nginx , the GD library, php config or other.

As far as I understand, @gplopes uses Mamp with the default Apache server? And you, @Theo, only experience this issue on your Raspberry, but not on your VPS, both running Nginx, right? Have you tested running your Raspberry with Apache yet?

@Theo, @gplopes
When exactly are the images generated, before you actually reload the page or really only on the second load?

What about memory settings? Cache settings?

Somehow it does indeed seem as if generating the images was too slow for some reason. But I can hardly imagine this happening with a single file only in a Mamp environment with standard Mamp settings, unless the images are really huge.

However, the whole purpose of generating thumbs asynchronously in Kirby 3 is to circumvent those memory issues that can happen when generating thumbs for many images or generating many image sizes.

Thanks @texnixe

To not pollute this thread, I replied on my thread :

I might have found the cause of my issue.

I had my own plugin which was loading a bunch of snippets and blueprints, once I removed and added them to Kirby default folder site/snippets and site/blueprint my issue seems to have despaired, so far.

A bit late, b my experience is hardly related and the solution might be useful for others, too.

I experienced that medias served for the very first time were “polluted” with a preceding newline character. Amongst others, this lead to broken image files served with a 200 HTTP Code . Due to caching headers sent by my provider’s server, these files we not reloaded for some time and the broken images were used instead.

The superfluous newline character was introduced by one of my plugin’s files starting with a newline followed by the <?php tag. Removing the newline solved the issue.

1 Like

Just to add stress the point @steirico made: I had a similar issue and looking for the problem’s root cause it turned out not to be in a plugin, but in the config.php, which started with a newline before the <?php. Removing the newline solved the issue. So anyone having a similar issue look please generally check for superfluous newlines. :wink:
And thanks for the help, @steirico. Your comment lead me on the right rack.

1 Like