Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
amwpsaa
Experienced
Topic Author
Posts: 53
Joined: 29 Jul 2021, 08:46

Why is my Files APP thumbnail generated by PHP?

31 Oct 2021, 04:15

My Files APP is all generated by PHP:
031161650.jpg
031161650.jpg (30.43 KiB) Viewed 6549 times
I expect the cache ,I want to force the use of file caching for all.


I tried to modify the settings, but to no avail.
load_files_proxy_php // false

Force images to load via PHP proxy if they can't be accessed by URL (for any reason).
image_resize_cache_direct // false

Will attempt to load cached resized images directly into the gallery, bypassing the Files PHP app. May cause faster loading and improved browser caching, since image files are loaded directly into browser. However, if this option is enabled and you delete the image cache, you may end up with missing image files because the Files app is not used to detect if the cached request exists or not. If this option is enabled and you DO delete the image cache, you will need to increase the cache_key setting by +1.
Attachments
QQ截图20211031151313.jpg
QQ截图20211031151313.jpg (24.85 KiB) Viewed 6550 times
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: Why is my Files APP thumbnail generated by PHP?

31 Oct 2021, 04:48

Ok, so this can easily be explained, but you need to understand there are many reasons this is disabled by default.

First of all, Files app uses FOLDER CACHE (located in _files/cache/folders). This means, when a folder is viewed for the first time, a JSON data file is created for the folder. This allows the folder to load much faster when viewed after the first time. When this cache file gets created, your images are not yet resized (because the folder has not been loaded, and resize requests have not yet been made). Therefore, the cached data file may not contain references to resized images, and it will not automatically update unless the folder changes. You can try this: Delete files in _files/cache/folders/* and new cache will be created with reference to images that are already resized. Please understand, Files app cannot check if resized images already exist, unless we disable folder cache, but that would make everything much slower.

In the Files app demo, I achieve this by first creating all images, and then force-recreating the folder cache AFTER all resized images are created. This is not practical, but is not too complicated becaiuse the Files app demo does not change much.

Also, why do you need to do this? It's not very productive. When Files app requests images through PHP, it will still output CACHED images, so it will still be fast. The benefit is that when routed through PHP, Files app can serve cached image (if already exists) and resize if it doesn't. If you want to always detect direct path to resized images, then it would not be possible to make it work with folder cache.

Also, keep in mind, it will not work with login enabled.