No thumbnails generated on Nginx

Seems like the files are not copied, but the .jobs.json file is available in the folder.

Are you sure that permissions are correct on the server? Try trashing the media folder on the server so that Kirby recreates it.

Also, please mark your thread as being for Kirby 3 :slight_smile: Thanks,

What is your environment, apart from Nginx? Seems like the router doesn’t work correctly.

Is everything else working correctly, including the Panel?

I seem to have a similar issue on my server configuration using Nginx. I could not find any information as to what these .jobs/file.jpg.json are all about:

image

@texnixe, you are saying that the router seems to be the issue. Is there any recommended Nginx configuration apart from this old gist?

For what it’s worth, I am having no issue on my local machine (macOS 10.14.4 using Laravel Valet), and the production server is a Ubuntu 18 server and everything else seems to work fine, including the panel. I have set my image driver to Image Magick in the config.php file.

@mxdvl

In your case it looks as if at least one file has been created, so that means something does work after all, just wonder why that file is so tiny.

Is that file actually resized or does it just have the thumbnails name?

@texnixe

Yes, that file is created, and I use it as a background, which works fine. It is called before the other thumbs in the header.php snippet:

$thumb = $image->thumb(['height' => 32, 'blur' => 2]);

echo '<div class="frame" style="background-image: url('.$thumb->dataUri().')">';

$sizes = [320, 640, 960, 1280, 1440, 1680, 1920, 2880, 3840];
$sizes[] = $image->width();

echo '<img src="'.$image->url().'" srcset="';
  
foreach ($sizes as $size) {
  if($image->width() < $size) continue;
  $quality = ceil(96-$size/100);
  $thumb = $image->thumb(['width' => $size, 'quality' => $quality]);
  echo ''.$thumb->url().' '.$size.'w ,';
}

echo'">
</div>';

And that is really the only one that is every created? The should be at least one additional image from the srcset that corresponds to the current screen size. Thumbs are created on the fly, as requested by the browser.

Indeed, there is an image that should be loaded, but isn’t. Only the job.json file is there.

The page that calls this is https://roybastien.mxdvl.com and it does make the proper request to the 1280px wide image above, which returns a 404 error.

EDIT: Editing the nginx configuration to remove the following line seems to solve the issue partially:

rewrite ^/kirby/(.*)$ /index.php?$1;

Hm, I’m not familiar with nginx at all, the 1280 px image is also generated, all the rest isn’t. No idea what’s going on there.

I seem to have fixed the issue by adding the following line to my Nginx configuration

error_page 404 /error;

This way, index.php gets called when the page isn’t found, which I believe is essential for Kirby to create the thumbnail. Maybe this will solve your issue too, @vanjim ?

5 Likes

I think this works for me too.
I had the same problem with Kirby 3 on my fresh installed nginx server (1.14.3).

I believe this fixes my error!

1 Like

after adding leverage browser cache settings for images and co, kirby did not create thumbnails anymore, but still the jobs. by adding the line above to the nginx.conf, it works again.

I know this is an old thread, but I’ve been having exactly the same issue. I have a 1yr cache expiry on all static files. Removing the caching solved the problem of images not being generated, but of course I want images to be cached. Adding the error_page 404 /error; line as suggested by @mxdvl solves the issue for me.

1 Like