Hi,
It’s not possible. The plugin depends on correctly timestamped images and doesn’t have any clean up functionality. It just reads images in a folder.
You have to implement your own script that will us WP cron to periodically delete old files in that folder. Or you can use some plugin that can do that. Quick search led me to this: https://ww.wp.xz.cn/plugins/bulk-delete/
Radek
In cpanel you could just implement a cronjob:
find /home/...servername/public_html/domain/wp-content/uploads/webcam -type f -mmin +28 -delete
Good tip. Thanks for sharing!
Hi
I fixed with problem with a small change – see the unlink loop below. Hope that helps!
Peter
// Returns filename of the last webcam image.
function get_last_filename($subdir) {
$upload_dir = wp_upload_dir();
$webcam_dir = $upload_dir[‘basedir’] . ‘/’ . WEBCAM_DIR . ‘/’;
if ($subdir && preg_match(‘/[a-z0-9]/i’, $subdir)) {
$webcam_dir .= $subdir . ‘/’;
}
foreach (array_filter(glob($webcam_dir . ‘*’), ‘is_file’) as $path) {
$last_filename = basename($path);
}
// Added code: Unlink all but latest image
foreach (array_filter(glob($webcam_dir . ‘*’), ‘is_file’) as $path) {
if ($last_filename <> basename($path)){
unlink($path);
}
}
// … end of added code
return $last_filename;
};