You are here

function theme_imagecache in ImageCache 5.2

Same name and namespace in other branches
  1. 5 imagecache.module \theme_imagecache()
  2. 6.2 imagecache.module \theme_imagecache()

Create and image tag for an imagecache derivative

Parameters

$namespace: presetname of the derivative you wish to generate a tag for.

$path: path to the original image you wish to create a derivative image tag for.

$alt: img tag alternate text

$title: img tag title text

attributes: optional drupal attributes array. If attributes is set, the default imagecache classes will not be set automatically, you must do this manually.

1 theme call to theme_imagecache()
imagecache_field_formatter in ./imagecache.module
Implementation of hook_field_formatter().

File

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

Code

function theme_imagecache($namespace, $path, $alt = '', $title = '', $attributes = null) {

  // check is_null so people can intentionally pass an empty array of attributes to override
  // the defaults completely... if
  if (is_null($attributes)) {
    $attributes['class'] = 'imagecache imagecache-' . $namespace;
  }
  $attributes = drupal_attributes($attributes);
  $imagecache_url = imagecache_create_url($namespace, $path);
  return '<img src="' . $imagecache_url . '" alt="' . check_plain($alt) . '" title="' . check_plain($title) . '" ' . $attributes . ' />';
}