You are here

function imagefield_update_6005 in ImageField 6.3

Delete thumbnails spread throughout the files directory.

File

./imagefield.install, line 311

Code

function imagefield_update_6005() {
  $ret = array();
  $result = db_query("SELECT * FROM {files} WHERE filemime LIKE 'image/%'");
  while ($file = db_fetch_object($result)) {

    // ImageField 6002 thumbnail path.
    $thumb_path_a = $file->filepath . '.thumb.jpg';

    // ImageField 6004 thumbnail path.
    $extension_dot = strrpos($file->filepath, '.');
    $extension = substr($file->filepath, $extension_dot + 1);
    $basepath = substr($file->filepath, 0, $extension_dot);
    $thumb_path_b = $basepath . '.thumb.' . $extension;
    file_delete($thumb_path_a);
    file_delete($thumb_path_b);
  }
  $ret[] = array(
    'success' => TRUE,
    'query' => t('Deleted admin thumbnails distributed throughout files directory. All thumbnails are now stored in the "imagefield_thumbs" directory.'),
  );
  return $ret;
}