# Thumbs not generated (using CloudPanel one server)

**URL:** <https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499>\
**Category:** Questions\
**Tags:** v3\
**Created:** [September 18, 2022, 5:00am UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499 "2022-09-18T05:00:08Z")\
**Posts on this page:** 14\
**Page:** 2

<div class="post-metadata">

**Author:** ![parislettau](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/parislettau/32/8524_2.png) [@parislettau](https://forum.getkirby.com/u/parislettau)\
**Post date:** [September 19, 2022, 7:59am UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499/21 "2022-09-19T07:59:59Z")

</div>

> [@texnixe](#):
>
> Are the thumbs for the Panel generated, i.e. the small preview images for sections etc.?

Sadly nothing is generated — not on the fly when loading a page nor through the panel even when uploading new media (the same media that is successfuly converted with the resize pluging).

> [@texnixe](#):
>
> since the autoresize plugin uses Kirby’s thumb functionality, it seems to be working in general.

Yes, which makes it all the more odd why Kirby cannot seem to generate thumbs on its own.

---

<div class="post-metadata">

**Author:** ![parislettau](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/parislettau/32/8524_2.png) [@parislettau](https://forum.getkirby.com/u/parislettau)\
**Post date:** [September 19, 2022, 8:13am UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499/22 "2022-09-19T08:13:14Z")

</div>

> [@texnixe](#):
>
> Kirby’s thumb functionality, it seems to be working in general

I just added to a template:

```auto
   exec('convert -v', $output);
   dump($output);

```

It succesfully prints:

```auto
0
Array
(
[0] => siteowner
[1] => Version: ImageMagick 7.1.0-48 Q16-HDRI x86_64 c1ca24765:20220910 https://imagemagick.org
[2] => Copyright: (C) 1999 ImageMagick Studio LLC
[3] => License: https://imagemagick.org/script/license.php
[4] => Features: Cipher DPC HDRI Modules OpenMP(4.5)
[5] => Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib gvc heic jbig jng jp2 jpeg jxl lcms lqr ltdl lzma openexr pangocairo png ps raqm raw rsvg tiff webp wmf x xml zip zlib

[...]

```

---

<div class="post-metadata">

**Author:** ![parislettau](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/parislettau/32/8524_2.png) [@parislettau](https://forum.getkirby.com/u/parislettau)\
**Post date:** [September 20, 2022, 11:17pm UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499/23 "2022-09-20T23:17:23Z")

</div>

> [@texnixe](#):
>
> Kirby’s thumb functionality, it seems to be working in general.

@texnixe do you know which lines of code in Kirby trigger thumbs generation when a url is called?

I added `echo ("ImageMagick command: " . $command);` to ImageMagick.php at line 161.

This has revealed that the command is in fact not being triggered.

The command is however triggered by [Blurry Placeholder Images for Kirby](https://github.com/johannschopplich/kirby-blurry-placeholder) plugin, which is recorded in the log thanks to the `echo ("ImageMagick command: " . $command);`.

In short: I need to identify why the thumbs code is not being triggered like normal.

Thank you for all your help and patience!

---

<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:** [September 21, 2022, 7:56am UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499/24 "2022-09-21T07:56:25Z")

</div>

> [@parislettau](#):
>
> 161

And if you log before the command is executed? What code are you using in your template?

`process()` is called in the thumb component.

---

<div class="post-metadata">

**Author:** ![parislettau](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/parislettau/32/8524_2.png) [@parislettau](https://forum.getkirby.com/u/parislettau)\
**Post date:** [September 21, 2022, 9:01am UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499/25 "2022-09-21T09:01:27Z")

</div>

> [@texnixe](#):
>
> And if you log before the command is executed?

I get an error `Undefined variable $output`

> [@texnixe](#):
>
> What code are you using in your template?

PHP — if that is what you’re asking?

---

<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:** [September 21, 2022, 9:03am UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499/26 "2022-09-21T09:03:03Z")

</div>

> [@parislettau](#):
>
> PHP — if that is what you’re asking?

Sorry, I meant to actually see the code from your template.

> [@parislettau](#):
>
> I get an error `Undefined variable $output`

Yes, `$output` is not defined before the `exec` command is executed, because that’s something `exec` returns.

But that means that the `process()` command is at least triggered.

---

<div class="post-metadata">

**Author:** ![parislettau](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/parislettau/32/8524_2.png) [@parislettau](https://forum.getkirby.com/u/parislettau)\
**Post date:** [September 21, 2022, 9:06am UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499/27 "2022-09-21T09:06:07Z")

</div>

> [@texnixe](#):
>
> Sorry, I meant to actually see the code from your template.

Nothing unusual as far as I can tell

here is `exhibition.php` (please don’t judge my coding!)

```auto
<!-- header -->
<?php snippet('header') ?>
<!-- nav -->
<?php snippet('nav') ?>
<!-- content -->
<main id="main" class="page-container page-wrapper">

    <!-- container -->
    <div class="main-container">
        <!-- filtered result -->
        <?php snippet('exhibition/exhibition') ?>
    </div>
</main>
<!-- footer -->
<?php snippet('footer') ?>

```

Here is the main snippet:

```auto
<div class="main-img-container">
    <?php
    if ($page->cover()->toFile()) {
        $image = $page->cover()->toFile();
    } else {
        $image = $page->image();
    }
    ?>
    <img src="<?= $image->placeholderUri() ?>" data-src="<?= $image->url() ?>" data-lazyload alt="<?= $image->alt() ?>" />

</div>
<div class="main-exhibition-text-container">
    <?= $page->title() ?><br>
    <?= $page->startDate()->toDate("d.m.Y") ?><?php if ($page->startDate()->isNotEmpty() && $page->endDate()->isNotEmpty()) : ?>—<?php endif ?><?= $page->endDate()->toDate("d.m.Y") ?><br><br>
    <?= $page->text()->kt() ?>
</div>

<div class="layouts">
    <?php foreach ($page->layout()->toLayouts() as $layout) : ?>
        <section class="grid" id="<?= $layout->id() ?>">
            <?php foreach ($layout->columns() as $column) : ?>
                <div class="column" style="--span:<?= $column->span() ?>; --columns:<?= $column->span() ?>">
                    <?php foreach ($column->blocks() as $block) : ?>
                        <div id="<?= $block->id() ?>" class="block block-type-<?= $block->type() ?>">
                            <?= $block ?>
                        </div>
                    <?php endforeach ?>
                </div>
            <?php endforeach ?>
        </section>
    <?php endforeach ?>
</div>

```

---

<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:** [September 21, 2022, 9:08am UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499/28 "2022-09-21T09:08:43Z")

</div>

Hm, but unless I’m blind I don’t see any thumb creation code?

Guess the `placeholderUri()` method is something provided by the blurry placeholder plugin.

---

<div class="post-metadata">

**Author:** ![parislettau](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/parislettau/32/8524_2.png) [@parislettau](https://forum.getkirby.com/u/parislettau)\
**Post date:** [September 21, 2022, 9:09am UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499/29 "2022-09-21T09:09:19Z")

</div>

> [@texnixe](#):
>
> But that means that the `process()` command is at least triggered.

This may only have been the case for the [Blurry Placeholder Images for Kirby](https://github.com/johannschopplich/kirby-blurry-placeholder) plugin, which is succesfully generating placeholder thumbs when a url is called — just the actual image isn’t having it’s thumb generated

---

<div class="post-metadata">

**Author:** ![parislettau](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/parislettau/32/8524_2.png) [@parislettau](https://forum.getkirby.com/u/parislettau)\
**Post date:** [September 21, 2022, 9:19am UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499/30 "2022-09-21T09:19:53Z")

</div>

> [@texnixe](#):
>
> Hm, but unless I’m blind I don’t see any thumb creation code?
> 
> Guess the `placeholderUri()` method is something provided by the blurry placeholder plugin.

My understanding is that `thumbs` method is used to generate the “thumbs” for all page media? (but correct me if I’m wrong!)

So the issue is that media uploaded through the panel results in no “thumbs” being generated in the `/media/.../page` directory (nor when a URL is called). Same for the panel.

So e.g., the panel looks like this:

 ![Screen Shot 2022-09-21 at 7.19.21 pm](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/4/41347ebfb9ca7ff5d35c4476466265893df6dc42.png)

---

<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:** [September 21, 2022, 9:50am UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499/31 "2022-09-21T09:50:39Z")

</div>

Ok, understand. I’m almost at my wits end. Which Kirby version are you using? I guess locally everything works fine?

---

<div class="post-metadata">

**Author:** ![parislettau](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/parislettau/32/8524_2.png) [@parislettau](https://forum.getkirby.com/u/parislettau)\
**Post date:** [September 21, 2022, 9:55am UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499/32 "2022-09-21T09:55:42Z")

</div>

Yep locally everything is fine. Same on a server not using CloudPanel.

I’m using the latest Kirby 3.7.1

---

<div class="post-metadata">

**Author:** ![parislettau](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/parislettau/32/8524_2.png) [@parislettau](https://forum.getkirby.com/u/parislettau)\
**Post date:** [September 21, 2022, 9:57am UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499/33 "2022-09-21T09:57:31Z")

</div>

> [@texnixe](#):
>
> I’m almost at my wits end.

Me too lol!

One last pathway I could try. Do you know how I might log an error in the Kirby code so that any failure of media thumbs generation when uploading an image via the panel might be seen?

---

<div class="post-metadata">

**Author:** ![invasoria](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/invasoria/32/10898_2.png) [@invasoria](https://forum.getkirby.com/u/invasoria)\
**Post date:** [April 12, 2023, 7:01am UTC](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499/34 "2023-04-12T07:01:25Z")

</div>

Hey, just wanted to bring this thread back from limbo to say that I was able to solve this issue on my end with the thumbnail generation not working on CloudPanel by removing some code from my nginx Vhosts config file. Specifically, I removed the following lines:

```auto
location ~* ^.+.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf|map)$ {
add_header Access-Control-Allow-Origin "*";
expires max;
access_log off;
}

```

 ![Screenshot 2023-04-12 at 12.54.56 AM](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/3/3e2d4432da9272671cb7e50a95f14f4b412f372c.png)

I was cracking my head open with this one, but thankfully it turned out to be a simple solution.

I figured this one out by seeing that I could not access any file with the extensions mentioned in that line. I asked ChatGPT about this and it kinda explained it ~~pretty well~~ :

> This location block is defining a regular expression that matches any URL path that ends with a file extension specified in the parenthesis. The directive `add_header Access-Control-Allow-Origin "*"`, adds a response header `Access-Control-Allow-Origin` with a value of `*`, which allows any website to access the content of the resource.

> The `expires` directive sets a cache expiration time for the resources, which is set to `max`, indicating that the resource should be cached indefinitely. The `access_log` directive is set to `off`, disabling access logging for these types of resources.

> It’s possible that this block was causing issues because it was too broad in its matching and was potentially interfering with other parts of the configuration. However, if you want to enable the `Access-Control-Allow-Origin` header for specific resources, you can modify this block to match only those specific resources instead of matching all files with certain extensions.

Hope this helps someone else who may be experiencing a similar issue with Kirby in CloudPanel servers/sites.

[Previous page](https://forum.getkirby.com/t/thumbs-not-generated-using-cloudpanel-one-server/26499.md?page=1)
