You are here

function imagecache_preset_by_name in ImageCache 5.2

Same name and namespace in other branches
  1. 6.2 imagecache.module \imagecache_preset_by_name()

Load a preset by name.

Parameters

preset_name:

Return value

preset array( 'presetname' => string, 'presetid' => integer) empty array if preset_name is an invalid preset

2 calls to imagecache_preset_by_name()
imagecache_field_formatter in ./imagecache.module
Implementation of hook_field_formatter().
_imagecache_cache in ./imagecache.module
handle request validation and responses to imagecache requests.

File

./imagecache.module, line 795
Dynamic image resizer and image cacher.

Code

function imagecache_preset_by_name($preset_name) {
  static $presets_by_name = array();
  if (!$presets_by_name && ($presets = imagecache_presets())) {
    foreach ($presets as $preset) {
      $presets_by_name[$preset['presetname']] = $preset;
    }
  }
  return isset($presets_by_name[$preset_name]) ? $presets_by_name[$preset_name] : array();
}