function imageinfo_cache_check_file in Imageinfo Cache 6.2
Same name and namespace in other branches
- 6 imageinfo_cache.module \imageinfo_cache_check_file()
Check that the file object has everything we need.
Parameters
$file: object File info
$op: string insert or delete
4 calls to imageinfo_cache_check_file()
- imageinfo_cache_file_delete in ./
imageinfo_cache.module - Implements hook_file_delete().
- imageinfo_cache_file_insert in ./
imageinfo_cache.module - Implements hook_file_insert().
- imageinfo_cache_nodeapi in ./
imageinfo_cache.module - Implements hook_nodeapi().
- imageinfo_cache_shutdown_async in ./
imageinfo_cache.module - Function that gets called right after a file has been uploaded.
File
- ./
imageinfo_cache.module, line 613 - Cache image info for theme_imagecache & theme_imagefield_image.
Code
function imageinfo_cache_check_file($file, $op) {
// Make sure file has the correct info an it is an image.
if ($op == 'insert') {
if (is_object($file) && !empty($file->fid) && !empty($file->field['type_name']) && !empty($file->field['field_name']) && !empty($file->filepath) && strpos($file->filemime, 'image') !== FALSE) {
return TRUE;
}
else {
return FALSE;
}
}
elseif ($op == 'delete') {
if (is_object($file) && !empty($file->fid) && !empty($file->filepath) && strpos($file->filemime, 'image') !== FALSE) {
return TRUE;
}
else {
return FALSE;
}
}
}