K2->k3 superslow thumb generation?

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)

Both local and remote.

How to troubleshoot?

Thanks

2 Likes

Are the thumbnails generated? Which driver are you using?

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 Like

Default driver and there are folders and images in the media folder.

What you mention @bnomei is what I thought may be happening, I am goint to attempt what you suggest, see if that solves it.

Thank you

How much ram is set in php.ini? The generation uses ram of course. If there isnt enough it can take a while or fail, or take multiple goes.

-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?

Thanks

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?

Yes, even uploading a single image results in the thumb not being generated until refresh etc.

Same local server, two different k3 sites, one shows this behaviour the other does not.

Plugins?

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());
                }
            }
        }
    }
]

I was just checking: kirby-builder and kirby-embed

Kirby embed for Kirby 3? Does that even exist?

Thanks @jimbobrjames but as this happens with the same image on one site and not the other, then the culprit may lay elsewhere.

@texnixe https://github.com/sylvainjule/kirby-embed

I dont follow. I thought you are seeing this both locally and remote?

What if you disable the plugins?

@jimbobrjames I meant two different sites in my local server, this one has this behaviour, the other does not

@texnixe let me try, yes… is there a… clean way of disabling a ‘manually’ installed plugin other than moving the folder or perhaps renaming ?

Removing the plugin folders is usually the easiest way, depending on how you installed them.

Not that easy with fields…

I tried removing both plugin folders and I am getting the same behaviour, what else could be in the way?

Considering this is a k2->k3 may there be something left during the upgrade process that could produce this behaviour?

I’d say I followed all the instructions.

Thanks

Do you get the same with the Kirby starter kit?

just cloned the repo and no, not at all, but I really don’t see this behaviour in any of the locally installed sites other than this particular one