You are here

function imagecache_field_formatter in ImageCache 5

Same name and namespace in other branches
  1. 5.2 imagecache.module \imagecache_field_formatter()

Implementation of hook_field_formatter().

File

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

Code

function imagecache_field_formatter($field, $item, $formatter) {
  if (empty($item['fid'])) {
    return '';
  }

  // Views does not load the file for us, while CCK display fields does.
  if (!isset($item['filepath'])) {
    $file = _imagecache_file_load($item['fid']);
    $item = array_merge($item, $file);
  }
  $rules = _imagecache_get_presets();
  $formatter_check = preg_replace('/_linked$/', '', $formatter);
  if (in_array($formatter_check, (array) $rules)) {
    return theme('imagecache_formatter', $field, $item, $formatter);
  }
}