function imageinfo_cache_presets_to_generate in Imageinfo Cache 6
Same name and namespace in other branches
- 6.2 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
1 call to imageinfo_cache_presets_to_generate()
- imageinfo_cache_primer in ./
imageinfo_cache.module - Run various theme functions so the cache is primed.
File
- ./
imageinfo_cache.module, line 523 - Cache image info for theme_imagecache & theme_imagefield_image.
Code
function imageinfo_cache_presets_to_generate($file = NULL) {
$presets = array();
$all = TRUE;
// 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'], array());
if (empty($field_settings)) {
return array();
}
$all = FALSE;
if (!is_array($field_settings) && $field_settings == TRUE) {
$all = TRUE;
}
if (variable_get('imageinfo_cache_imagecache_pregenerate', IMAGEINFO_CACHE_IMAGECACHE_PREGENERATE) == 1) {
$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;
}