I’m administrating a server with several Kirby sites. I recently noticed that during every page load, dozens of images are being created within the media/ folder structure, and then deleted immediately after. Are these sites misconfigured? Shouldn’t these images stay on the filesystem for subsequent requests? I believe they are scaled images. The srcset plugin is installed on both sites. Where should I investigate further?
Yes, once created, the thumbs should stay where they are.
Kirby first creates job files, then these jobs are transformed into thumbs when the url is requested. Unless there are changes to the original, new thumbs are only created if the media folder or the thumbs in it are deleted.
yeah, strangely, the scaled images are created and deleted in the same request. they never remain. i’ve done a find through the media/ directories, and there just aren’t any there. furthermore, i’ve monitored filesystem activity with inotifywait, and i see the sites create the images and then immediately delete them without a millisecond to spare. one installation is kirby 3.4.4, another is 3.4.2. both running through nginx and php 7.2.
Could you post what config options are set for this plugin? Or the config for one of the projects in general if it doesn’t contain any secrets like API keys etc.? If there is more than one config file, then all config files.
What I’m particularly looking for is a debug mode setting for the plugin.
Debug should always be set to false on a production server, but if setting this to false doesn’t have any effect regarding the thumbs, then maybe the plugin doesn’t do anything different depending on that mode, I didn’t really study the source code thoroughly.
This setting should also always be set to false on production, but has nothing to do with the issue, just a security thing.
I currently have no other ideas, if that is all in the configs and there are no other plugins. but if you have the time, try to install a fresh Starterkit and check if that behaves as it should.
It usually just a matter of copying the files over to a server. The only thing that we don’t provide is the nginx config that corresponds to what is in the default .htaccess, but you should be able to use that from the other projects.
Which reminds me that it might be worth looking into this config and if it has any settings that might interfere with the thumbs.
this was created as i was troubleshooting permission issues while getting things running (at first media didn’t have write permissions. after fixing it, i requested the URL to the above image to test)
ok, i figured it out. the php-gd extension simply wasn’t installed! is there a quicker way i could have caught this? like, are the exceptions logged anywhere?
Good question, I was under the impression that the thumbs were getting created, because without gd, only the originals would ever be copied and no thumbs created.
well, i came at this problem from a very unusual angle. most people would never see that the thumb files are technically being created, i just happened to be closely monitoring the filesystem (for completely unrelated reasons).
Yes, you are right, if the developer doesn’t check they really get the expected result, then the error might go unnoticed, because instead of throwing an error, the not-real-thumbs are silently removed. Guess that is so that the site continues to work even if no thumbs are generated.
GD or ImageMagick are a server requirement though for Kirby to work, so developers should make sure that a server meets these requirements before putting things out to a production server.
Its odd that GD wasnt installed, this is usually the default for most hosts. Is this typical off the shelf hosting, or something you put together urself, like a VPS or something? I find IM gives better results in most cases but its odd that GD was missing.