I’ve upgraded a site to k3. It has tons of images. Both old and new images do not appear on panel upload OR frontend page load until refreshing panel or page, sometimes twice or thrice (may be time, not number of refreshes)
kirbys thumbs are generated on request. sometimes a new thumb is not generated fast enough for browser accept it as valid. most browsers cache that result and only a few seconds and/or new requests timeout that cache.
consider removing the media folder and use php cli to generate all thumbs (not single page requests). see this thread
-1 locally , I have to check about the remote server…
still… I am not sure I understand… why is it that uploading a new image to this website through the panel results in the panel thumb not being generated until a while later and the image showing as broken in the frontend until a while later?
I haven’t experienced this in other sites at all…
If I generate all thumbs via janitor cli, for example, will new images thumbs load normally from then on, both on the panel and the frontend?
So does this also happen if you upload a single image? If all works as it should, such an uploaded image should immediately appear in the Panel without a refresh. What size of single image are we talking here?
Also, what kind of images are we talking about? Jpeg? Png? How big are they? What are the pixel dimensions and file size?
PNG’s can take a little more horsepower than Jpegs.
if they are big in pixel dimensions, you might like to try using a hook that scales them down on upload. In the example below, it will scale images larger than 2,000 down to 2,000 on upload…
'hashandsalt.maxWidth' => 2000,
// Hooks
'hooks' => [
// Scale Big Images Down
'file.create:after' => function ($file) {
if ($file->isResizable()) {
if ($file->width() > option('hashandsalt.maxWidth')) {
try {
kirby()->thumb($file->root(), $file->root(), [
'width' => option('hashandsalt.maxWidth')
]);
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
}
}
}
]