Search…

X3 Photo Gallery Support Forums

Search…
 
CoonDog
Topic Author
Posts: 4
Joined: 26 Feb 2026, 09:48

Disable Render/Resize Cache

26 Feb 2026, 22:59

Is it possible to disable all render/resize cache in Photo Gallery so file count does not multiply?

I use 'image_resize_cache' => false, in files gallery.

Even a scheduled Delete Image Cache would work, but I would think harder.

Old archive site, no new pics in 10 years, server does good with Files Gallery. Have 200,000 pictures and server limit is 250,000.

Thanks
 
CoonDog
Topic Author
Posts: 4
Joined: 26 Feb 2026, 09:48

Re: Disable Render/Resize Cache

27 Feb 2026, 11:49

Update!

I set render folder to unwriteable with no luck.  This option never generates cache and hangs right there.

I set up a cron job that checks render folder for file count.  If file count is over preset threshold it empties render folder.  Works just like it should!

If cron is the best or only option I should be good to go.  If you have a better option or disabling all together any input is appreciated.  

Thanks!
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14469
Joined: 30 Sep 2006, 03:37

Re: Disable Render/Resize Cache

27 Feb 2026, 20:59

It's a bit unclear what you are trying to do here ... Could it be you are mixing concepts of Files Gallery and X3? When Files Gallery runs standalone, it uses it's own "image_resize_cache" config, but when using Files Gallery with X3, it uses the images ALREADY created by X3, as that is one of the benefits, so we don't need duplicate thumbnails per application. It's a bit difficult to understand the question and/or exactly what you are trying to do.
CoonDog wrote: Is it possible to disable all render/resize cache in Photo Gallery so file count does not multiply?
Why would you do that though? ... X3 needs thumbnails, so where is it going to get thumbnails from if you disable resize cache (render folder)? We could have implemented a solution that resizes images on-demand, every single time it was requested, but this is extremely hard work for the server. It would basically be stuck in creating identical thumbnails. This simply isn't productive.
CoonDog wrote:I use 'image_resize_cache' => false, in files gallery.
For reference, `image_resize_cache` is a Files Gallery specific option. It does not apply when using Files Gallery with X3, because Files Gallery would then use the images already created by X3. Besides, when disabled in Files Gallery, it means icons will display instead of preview images. It is possible in Files Gallery to resize images "on demand", but this is extremely intense work for server, and almost never a good idea.
CoonDog wrote:I set render folder to unwriteable with no luck. This option never generates cache and hangs right there.
If done properly, this should work. However, what are you hoping to achieve by disabling thumbnails in X3? It would caused "broken image" when thumbnails are trying to display on the page.
CoonDog wrote:I set up a cron job that checks render folder for file count. If file count is over preset threshold it empties render folder. Works just like it should!

If cron is the best or only option I should be good to go. If you have a better option or disabling all together any input is appreciated.
Although I understand you want to prevent too many files, you can't just disable image resize cache. Where would it get thumbnails from? Even if you partially delete some files or the entire cache, files will just need to then get recreated, causing a lot of unnecessary processing by the server.
 
CoonDog
Topic Author
Posts: 4
Joined: 26 Feb 2026, 09:48

Re: Disable Render/Resize Cache

01 Mar 2026, 22:04

If I generate all panel and gallery thumbs for 200,000 images that would 600,000 files total.  My server max files is 250,000 so I would need 3 servers.  My gallery only gets a handful of hits a month and have been running files.gallery for a couple years with no cache. 100% have to run with no cache or delete every now and then.  

I guess the question was can you disable render cache like you can in with false in files.gallery?  If not I am completely fine with the cron job to delete cache when it gets to 20,000 files this way it never maxes out my server. Thanks for the help!
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14469
Joined: 30 Sep 2006, 03:37

Re: Disable Render/Resize Cache

01 Mar 2026, 23:01

CoonDog wrote: If I generate all panel and gallery thumbs for 200,000 images that would 600,000 files total.  My server max files is 250,000 so I would need 3 servers.  My gallery only gets a handful of hits a month and have been running files.gallery for a couple years with no cache. 100% have to run with no cache or delete every now and then.
Yes, this is possible in Files Gallery, but depending on your settings and images, it's only possible with relatively extreme compromises. At least one of the below would need to be true:
  • You have disabled thumbnails entirely.
  • You are loading original size images as thumbnails (imagine loading 100 x thumbnails x 5 MB, which would require loading 500 MB into browser, just for some thumbnails, and would require extreme amounts of memory to hold the images).
  • You are resizing images "on demand" for every single image/thumbnail for every single visitor, every single time they visit the page/images. Not only would it be extremely slow, but it would require so much CPU that it would bring any server to it's knees. The only scenario where this might even work, is if there is only 1 visitor and the images are relatively small.
Because of the above, and because X3 can't operate "without" thumbnails (like Files Gallery), disabling cached thumbnails is not an OPTION. I do understand your issue with MAX NODES on your server, but there really isn't any way we can offer useful thumbnails in a photo gallery website application, without storing resized images as thumbnails.

If you really need to do it, and you think it will work for you, you could edit the code directly. Open /app/parsers/slir/index.php, and comment out line 493:
Code
// if(!file_put_contents($this->cache_path, $data)) $this->error('Failed to save cache ' . $this->cache_path, 500);
The above should still create the thumbnail, and serve it to browser, without saving the thumbnail. Normally, this would be a bad idea, as it will cause your server to constantly having to resize all image requests.
CoonDog wrote:I guess the question was can you disable render cache like you can in with false in files.gallery?
With the above code edit yes, although Files Gallery has a few reasons why it could be useful to disable resize cache.
CoonDog wrote:If not I am completely fine with the cron job to delete cache when it gets to 20,000 files this way it never maxes out my server. Thanks for the help!
This might be useful to maintain temporary cache on the server, but it seems like an ineffective solution.

May I ask, why not just stick to Files Gallery in this case?
 
CoonDog
Topic Author
Posts: 4
Joined: 26 Feb 2026, 09:48

Re: Disable Render/Resize Cache

07 Mar 2026, 11:29

Sorry for the late reply!  My site is built with Forum, Portal and Files Gallery are spliced together.  The folder page for gallery now is is just a singe page with 925 links on it.  Thought it would look cleaner, safer and easier to update with Photo Gallery as main page and Simple Machines Forum on the side.  If lucky might get a couple of users a day to look at gallery.  The forum is no longer the main focus so gallery up front made more sense.  Was basically gonna run Photo Gallery standalone and a Forum standalone without all the integration with 3rd party addons.  At this point I dread updating the forum who knows how that will go.

Plan was to pull or make a header for a simple forum and that's it.  Way less complicated on frontend and backend.  If the spiders are gonna kill site or you plan on stopping development would be the only reason Photo Gallery would be worse I would think.   Was gonna look into Cloud Flare once up and running. 

Other alternative would be standalone forum with gallery category with the links in there pointing to 925 separate Photo Gallery index files.  Files Gallery is also tricky to update right now.  This option would be cheesier than it is now.  Basically want to be done with portal/forum/files gallery/errors update mess.

I guess question would be would you do it or wouldn't you?  Pretty much zero traffic other than spiders. If I take Photo Gallery live I will purchase a license because I don't want to waste anymore of your time with my dumb ideas.  I have a few other questions but that can wait!

Site in question is https://wegotmud.com/   Note: Files Gallery Cache is disabled in config.php.

Take care!

.
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14469
Joined: 30 Sep 2006, 03:37

Re: Disable Render/Resize Cache

07 Mar 2026, 21:56

CoonDog wrote:If lucky might get a couple of users a day to look at gallery.
This is an argument to not cache thumbnails, and instead always create thumbnails "on demand". It is however still slow/ineffective, because when that one user visits your gallery and views 100 thumbnails, your server will need to resize those 100 images just for that user. And repeat the same process for next user, instead of serving already-resized images.

If you want to achieve this in X3, you can follow the suggestion in my previous post.
CoonDog wrote:Other alternative would be standalone forum with gallery category with the links in there pointing to 925 separate Photo Gallery index files.  Files Gallery is also tricky to update right now.
If you were having to use separate Files Gallery index.php files, you should at least create symlinks that point to a single "index.php" file so that it can easily be updated (or modified).

Of course, Files Gallery itself is created to be able to manage multiple dirs, and the reason for 925 different instances would normally be purely cosmetic. For example, in Files Gallery, you point to a ROOT dir, where all the gallery dirs are located somewhere in the hierarchy. Optionally, you could create different "users" which access different ROOT dirs, all from the same instance.
CoonDog wrote:I guess question would be would you do it or wouldn't you?  Pretty much zero traffic other than spiders. If I take Photo Gallery live I will purchase a license because I don't want to waste anymore of your time with my dumb ideas.  I have a few other questions but that can wait!
I'm struggling a bit to understand exactly the question. I checked your link, and as far as I can see, you are using a modified Files Gallery? It does seem to work reasonably well. I'm not sure what the arguments are for considering X3 Photo Gallery in this case.

In your case with Files Gallery:
  • You could use a single instance, and point to each gallery with ?path/to/gallery in the url. Then you could hide the menu and breadcrumbs, so that it still looks like it does know. Of course, you could just keep the menu and breadcrumbs, so that the visitor can navigate to other galleries directly from within the gallery.
  • I see in your gallery that original image sizes are relatively small (1366 px etc). This means that disabling resize cache could work, because it doesn't require too much CPU/memory to resize images of this size. Furthermore, you could set config image_resize_function to "imagecopyresized", which creates resized images about twice as fast.