You are here

function imagecache_preset_by_name in ImageCache 6.2

Same name and namespace in other branches
  1. 5.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

3 calls to imagecache_preset_by_name()
imagecache_drush_preset_flush in ./imagecache.drush.inc
Drush callback to perform actual imagecache preset flush.
imagecache_generate_image in ./imagecache.module
Generate a derivative image given presetname and filepath.
_imagecache_cache in ./imagecache.module
Handle request validation and responses to ImageCache requests.

File

./imagecache.module, line 1056
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();
}