# Only some images are resized using thumbs

**URL:** <https://forum.getkirby.com/t/only-some-images-are-resized-using-thumbs/28366>\
**Category:** Questions\
**Tags:** v3\
**Created:** [April 14, 2023, 11:25am UTC](https://forum.getkirby.com/t/only-some-images-are-resized-using-thumbs/28366 "2023-04-14T11:25:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikeharrison](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mikeharrison/32/9620_2.png) [@mikeharrison](https://forum.getkirby.com/u/mikeharrison)\
**Post date:** [April 14, 2023, 11:25am UTC](https://forum.getkirby.com/t/only-some-images-are-resized-using-thumbs/28366/1 "2023-04-14T11:25:32Z")

</div>

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

```auto
'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:

```auto
<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

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [April 14, 2023, 11:36am UTC](https://forum.getkirby.com/t/only-some-images-are-resized-using-thumbs/28366/2 "2023-04-14T11:36:08Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mikeharrison](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mikeharrison/32/9620_2.png) [@mikeharrison](https://forum.getkirby.com/u/mikeharrison)\
**Post date:** [April 14, 2023, 11:48am UTC](https://forum.getkirby.com/t/only-some-images-are-resized-using-thumbs/28366/3 "2023-04-14T11:48:38Z")

</div>

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

There was one error in the log:

```auto

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?

---

<div class="post-metadata">

**Author:** ![stffr](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@stffr](https://forum.getkirby.com/u/stffr)\
**Post date:** [April 14, 2023, 12:10pm UTC](https://forum.getkirby.com/t/only-some-images-are-resized-using-thumbs/28366/4 "2023-04-14T12:10:23Z")

</div>

> [@mikeharrison](#):
>
> Am I right that thumbs are generated on first page load?

Yes.

I think the [janitor plugin](https://github.com/bnomei/kirby3-janitor) has a command for pre-generating thumbs. I have not tested it though.

---

<div class="post-metadata">

**Author:** ![mikeharrison](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mikeharrison/32/9620_2.png) [@mikeharrison](https://forum.getkirby.com/u/mikeharrison)\
**Post date:** [April 14, 2023, 12:55pm UTC](https://forum.getkirby.com/t/only-some-images-are-resized-using-thumbs/28366/5 "2023-04-14T12:55:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mikeharrison](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mikeharrison/32/9620_2.png) [@mikeharrison](https://forum.getkirby.com/u/mikeharrison)\
**Post date:** [April 17, 2023, 3:40pm UTC](https://forum.getkirby.com/t/only-some-images-are-resized-using-thumbs/28366/6 "2023-04-17T15:40:43Z")

</div>

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
