Option to set permissions for generated thumbs

Hey there,

we are currently generating thumbs through the Kirby functions. It works great, except for one little detail: our deployment setup needs to delete these files. The thumbnails are created by the apache user. The deployment script is running with a different user.

Right now we are considering to use sudo to allow the deployment script to write any file.

The better solution would be to set custom permissions on each thumbnail that was created by Kirby. I would be willing to create a pull request for both Kirby and the Kirby Toolkit to allow this additional option to be set.

Would you be willing to merge that into the current code?
How much will change in terms of thumb generation in Kirby 3?

Thank you for your help!

Best Regards
Tobias

Why don’t you just exclude the thumbs folder from the deploy? They get regenerated on page load anyway. The only reason to upload them your self is if its a very image heavy site, and you want to do the generating job upfront, locally.

If you exclude the folder contents from the deploy, rather then getting your script to delete them, once every page has been viewed in a web browser, all the thumbs will be created again.

What does your deployment script actually involve? I normally suggested using bash to deploy via rSync, using the same user the webhosting is using.

Thank you for your suggestion.

Unfortunately we already exclude the thumbs folder from the deployment. What we do is to cleanup the complete previous folder inside which Kirby was installed. This makes sure we don’t have any previous artifacts left on the server.

As we delete everything, we also have to delete the thumbs folder. This does not work as the users are different.

Regarding using the same user, that’s also not possible inside out environment. Apache runs as the apache user, and that one is not supposed to connect via SSH. The user that has SSH access should not be the user as which Apache is running. :slight_smile:

Wondering why this only affects the thumbs and not other content created on the server. Or don’t you use the Panel to create content?

The content, which is indeed updated through the panel, can be modified through the panel hooks.

You could set up a cron job that modifies the thumbs permissions at a given interval, like once a day or whatever you need, I guess, if you don’t want to use sudo in your script.

I’m already implementing a solution for us with a custom thumbnail driver which extends the current functionality.

The request was more if this improvements would be accepted as pull request on Kirby and the Toolkit as well. :slight_smile:

Sorry, I can’t really answer this question. To me, it seems to be rather an edge case but please feel free to create a pull request, might after all be more people in need of this than is obvious at first sight.

Thank you. :slight_smile: