Re: Delete temporary images after loading website



I do the image generation with an external programme (gnuplot), so the
images are not generated by PHP directly.
I now found the following solution, which seems to work quite well:

/* remove older images in folder temp */

$command = "ls ".$_CONFIG["tempdir"];
exec($command, $output, $retval);
$time = time();
foreach ($output as $file) {
if (($time-filemtime($_CONFIG["tempdir"]."/".$file))>300) {
unlink($_CONFIG["tempdir"]."/".$file);
}
}

Thanks for your comments!
Andrea

.