Thumbnail regeneration - Kirby nginx permissions

I have some questions about thumbnail regeneration. When does kirby regenerate thumbnails?

I have a kirby installation where the website is put on the server via git, but the content folder via Dropbox. This is because it allows my coworkers to just drop images in the correct folders, which they find very easy. One of them did just that, overwriting an image because the new one has the same filename. The file is synced correctly, but the thumbnail is still the old one. So how can I force kirby to regenerate the thumbnail?

Edit: php runs as user www-data and the content and thumbs folder are owned by www-data. However it appears that no new thumbnails are being generated… Could this be a permissions issue?

Second edit: it is a permissions issue. The content folder in Dropbox is owned by another user (me), and then symlinked with the website, but www-data also needs to be owner of that folder. This presents some other difficulties but now I know what the problem is.

Well the easy way is to just trash the contents of the thumbs folder. The thumbs will get regenerated when the pages get accessed next in a browser, but I guess only if the permissions allow for it.

So even with www-data as owner of the thumbs folder, it looks like new thumbnails are not being regenerated. I deleted the thumbs folder for a new page, refreshed, and a new folder was created. However, no thumbnails in it were generated. :thinking: What could cause this?

Check the permissions on the source image. If it doesn’t have permission to read it, the thumbnail wont happen. I’m sure i saw that on my server once.

Thank you for your reply, by the way!

User www-data is owner of the original file and had -rw-rw-r-- permissions. Even with -rwxr-xr-x the new thumbnail is not being generated…

Look in your PHP log file for errors. If you don’t know where the php log lives, throw a phpinfo page up on the server and it will tell you. I suspect the permissions are screwed on the temporary working folder.

Strangely enough, my php error log is empty. The php7.0-fpm.log only has things like:

[07-Feb-2018 09:37:05] NOTICE: fpm is running, pid 10954
[07-Feb-2018 09:37:05] NOTICE: ready to handle connections
[07-Feb-2018 09:37:05] NOTICE: systemd monitor interval set to 10000ms
[07-Feb-2018 10:17:46] NOTICE: Terminating ...
[07-Feb-2018 10:17:46] NOTICE: exiting, bye-bye!
[07-Feb-2018 10:17:46] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful

[07-Feb-2018 10:17:46] NOTICE: fpm is running, pid 11219
[07-Feb-2018 10:17:46] NOTICE: ready to handle connections
[07-Feb-2018 10:17:46] NOTICE: systemd monitor interval set to 10000ms

So this is still a mystery for me. In any case thank you for your help!

Hmm… Try the Apache log.

Ah of course. This is my nginx log. It shows some errors from when I tried to change the nginx and php user—I thought that if I changed it to the same user as the Dropbox and ssh user it would solve my problems, but that just caused different problems. Below that some errors about uploading an image that was too large, but other than that, I don’t see anything about thumbnails.

Ah well im not expert on Nginx im afraid but there is a line in there down bottom there that gives me a hunch.

client intended to send too large body I think your PHP max body size is to low. This means if you post an image larger than that, it will fail.

Try setting these values higher in the php.ini and also thinking about giving PHP more ram to work with.

upload_max_filesize = 10M
post_max_size = 10M
client_max_body_size = 10M;
memory_limit = 64M ; Maximum amount of memory a script may consume

I find 128M works better than 64M, I work on a lot of portfolio style sites with large images.

and also I think your permissions are screwed on your temp folder (or the path is wrong):

PHP message: PHP Warning:  Unknown: open(/var/lib/php/sessions/sess_utm94dsc1vgsaa5fv7788dpga7, O_RDWR) failed: Permission denied (13) in Unknown on line 0
PHP message: PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/sessions) in Unknown on line 0" while reading response header from upstream, client: 83.85.63.225, server: davlstudio.com, request: "GET /panel/ HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm-robin.sock:", host: "davlstudio.com"

Theres some potential help on that in this thread.

Yep, changing those values in php.ini fixed the file upload issue. Thanks so much!

I actually came across that thread and I have already defined my panel links with the tilde.

The permissions on the temp folder being screwed I think is because I had set the nginx and php user to robin instead of www-data.

Awesome. You might want to delete that gist now, because the log gives away info about your server.