You are here

function image_cron in Image 6

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

Implements hook_cron. (deletes old temp images)

File

./image.module, line 146

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);
    }
  }
}