You are here

function image_cron in Image 5.2

Same name and namespace in other branches
  1. 5 image.module \image_cron()
  2. 6 image.module \image_cron()

Implements hook_cron. (deletes old temp images)

File

./image.module, line 306

Code

function image_cron() {
  $path = file_directory_path() . '/' . variable_get('image_default_path', 'images') . '/temp';
  $files = file_scan_directory(file_create_path($path), '.*');
  foreach ($files as $file => $info) {
    if (time() - filemtime($file) > 60 * 60 * 6) {
      file_delete($file);
    }
  }
}