Only some images are resized using thumbs

Hi,
I am having an odd issue with thumb generation on my Kirby site. I have set up the thumbs in config as follows:

'thumbs' => [
      'srcsets' => [
          'default' => [
              '300w'  => ['width' => 300],
              '600w'  => ['width' => 600],
              '900w'  => ['width' => 900],
              '1200w' => ['width' => 1200],
              '1800w' => ['width' => 1800],
              '2300w' => ['width' => 2300],
              '2880w' => ['width' => 2880],
          ],
          'webp' => [
            '300w'  => ['width' => 300, 'format' => 'webp'],
            '600w'  => ['width' => 600, 'format' => 'webp'],
            '900w'  => ['width' => 900, 'format' => 'webp'],
            '1200w' => ['width' => 1200, 'format' => 'webp'],
            '1800w' => ['width' => 1800, 'format' => 'webp'],
            '2300w' => ['width' => 2300, 'format' => 'webp'],
            '2880w' => ['width' => 2880, 'format' => 'webp'],
          ],
      ]
    ],

Which I am using like this in my templates:

<picture>
            <source
              srcset="<?= $image->srcset('webp') ?>"
              sizes="100vw"
              type="image/webp"
            >
            <img
              alt="<?= $image->alt() ?>"
              src="<?= $image->resize(1200)->url() ?>"
              srcset="<?= $image->srcset() ?>"
              loading="lazy"
              sizes="100vw"
              width="<?= $image->resize(1200)->width() ?>"
              height="<?= $image->resize(1200)->height() ?>"
            >
          </picture>

My issue is, while all the images are being generated with the correct resized suffix (e.g. -660x) but only some are being resized. It seems to be the larger widths that are not being created, but just the original file reproduced.

I have confirmed with the hosts that GD is installed and running, which makes sense as some of the images are being resized.

Has anyone hit this issue before? I am not sure how to tackle it as it is sometimes working and sometimes not

Hm, if you have really large images, you might be running into script timeout issues. Have you checked your server and PHP error logs for any hints?

Some of the images are pretty large, so that could be it.

There was one error in the log:


Allowed memory size of 268435456 bytes exhausted (tried to allocate 187631108 bytes) in /home/highlyflammable/dev/vendor/claviska/simpleimage/src/claviska/SimpleImage.php on line 185

I will try upping the memory limit and see if that helps. Each page has quite a lot of images on as well, so it is doing a lot of work per page on that initial load. Is there a way of generating thumbs on a per-image basis at all?

Am I right that thumbs are generated on first page load?

Yes.

I think the janitor plugin has a command for pre-generating thumbs. I have not tested it though.

Thanks I will take a look at Janitor - I think ideally I would like the thumbs generated on image upload, as I am always using the pre-defined set in config. It might mean a hook would be the best approach

The issue was the hosting server choking - I have upped the provision for the site and asked the client to resize images before upload, which seems to have fixed the issue.

Happy to have this thread closed / deleted