function imageinfo_cache_presets_to_generate in Imageinfo Cache 6.2
Same name and namespace in other branches
- 6 imageinfo_cache.module \imageinfo_cache_presets_to_generate()
Given a file object, get the imagecache presets to auto generate for it.
Parameters
$file: object File info
$op: string insert or delete
2 calls to imageinfo_cache_presets_to_generate()
- imageinfo_cache_primer in ./
imageinfo_cache.module - Run various theme functions so the cache is primed.
- imageinfo_cache_shutdown_async in ./
imageinfo_cache.module - Function that gets called right after a file has been uploaded.
File
- ./
imageinfo_cache.module, line 554 - Cache image info for theme_imagecache & theme_imagefield_image.
Code
function imageinfo_cache_presets_to_generate($file = NULL) {
$presets = array();
$all = TRUE;
if (!is_null($file) && is_array($file)) {
$file = (object) $file;
}
// Check the node type and CCK field name.
if (!is_null($file) && !empty($file->field['type_name']) && !empty($file->field['field_name'])) {
$field_settings = variable_get('imageinfo_cache_cck_widget_' . $file->field['type_name'] . '_' . $file->field['field_name'], IMAGEINFO_CACHE_CCK_WIDGET);
if (empty($field_settings)) {
return array();
}
$all = FALSE;
if (!is_array($field_settings) && $field_settings == TRUE) {
$all = TRUE;
}
if (!$all) {
foreach (imagecache_presets() as $preset) {
// Get preset name.
if (!empty($field_settings[$preset['presetid']])) {
$presets[] = $preset['presetname'];
}
}
}
}
if ($all) {
foreach (imagecache_presets() as $preset) {
// Get preset name.
$presets[] = $preset['presetname'];
}
}
return $presets;
}