No thumbnails generated on Nginx

nginx
media
#1

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

#2

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,

#3

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

Is everything else working correctly, including the Panel?

#4

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.

#5

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

#6

@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>';
#7

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.

#8

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;

#9

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.

StarterKit : images display only after reload page in the browser
#10

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 ?

1 Like
#11

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

#12

I believe this fixes my error!

1 Like