Hello,
My Piwigo site consists of about 33 000 photos.
Directories "galleries" and "upload" disk size are both about 1.3 GB.
Yesterday I cleaned directory _data using Maintenance -> Actions -> Purge Cache = All, and cache size lowered to 300 MB. Today _data size was 2.1 GB. A long time maximum has been double that size
"Configuration Photo sizes" are checked by system "Square", "Thumbnail" and "Medium". Those are permanent, I cannot uncheck. I have checked "Resize after upload" to 800 x 800. Image quality 95%.
My problem is that the web hotel contract of the disk size is 5 GB. If I clean daily "Purge cache" my site stays under 5 GB. If not cleaning the cache the disk size exceeds 5 GB the next day.
Is there available any automatic system to clean the cache, like cron?
The usage of the site is no way different if I clean cache daily or not. I understand the importance of the cache for the computer load. But also I am worried about higher expenses of the disk size.
Piwigo 15.7.0
Installed on 26 March 2018, 7 years 7 months 3 weeks 6 days ago
Operating system: Linux
PHP: 8.3.27 (Show info) [2025-11-23 10:49:34]
MySQL: 11.4.9-MariaDB-deb11 [2025-11-23 12:49:34]
Graphics Library: ImageMagick ImageMagick 6.9.11-60
Cache size 460.27 Mo calculated 3 minutes ago Refresh
Piwigo URL: https://www.aanimeri.fi/piwigo
Offline
I'm not sure if there is a built in way to do that with cron but at least with Piwigo 16 it is possible to create a web API method that could do what you need using cron and curl.
I'm running 16.0.0RC3 so that is what I used for testing this and it cleared the derivative cache for me.
Using the LocalFiles Editor plugin I added the following code to the Personal Plugin
add_event_handler('ws_add_methods', 'personal_ws_add_methods', EVENT_HANDLER_PRIORITY_NEUTRAL);
function personal_ws_add_methods($arr)
{
$service = &$arr[0];
$service->addMethod(
'personalplugin.clearAllDerivatives',
'personal_ws_clear_derivative_cache_all',
array(),
'Clear all cached derivative files',
null,
array(
'hidden' => false,
'admin_only' => true,
'post_only' => false,
)
);
}
function personal_ws_clear_derivative_cache_all()
{
include_once(realpath(PHPWG_ROOT_PATH).'/admin/include/functions.php');
clear_derivative_cache();
}Then I created an API key for my admin user on the profile page (https://mypiwigoinstance.example/profile.php). The API keys are a Piwigo 16 feature I think so I'm not sure how this works on 15.7.0 which I don't have installed.
Then I called that method with curl (see also https://github.com/Piwigo/Piwigo/wiki/Piwigo-Web-API) in a way that should work from cron.
curl -o /dev/null -s -H "Authorization: pkid-xxxxxxxx-xxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -d "method=personalplugin.clearAllDerivatives" -d "format=json" https://mypiwigoinstance.example/ws.php
Offline
moberley
thank you very much for your help.
I am that kind of Piwigo user who has no knowledge of code activities.
I just can install and use plugins.
So far I am running Piwigo 15.7.
My site also runs Drupal and I have learned there exists a module that from cron empties cache memory. There exists the same problem that cache may rise up to 10 times the database data.
Offline