You are here

function theme_emimage_image_thumbnail in Embedded Media Field 6

Same name and namespace in other branches
  1. 6.3 contrib/emimage/emimage.theme.inc \theme_emimage_image_thumbnail()
  2. 6.2 contrib/emimage/emimage.theme.inc \theme_emimage_image_thumbnail()

Format the image using the Thumbnail presets.

File

contrib/emimage/emimage.theme.inc, line 73
Theme functions for Embedded Media Image

Code

function theme_emimage_image_thumbnail($field, $item, $formatter, $node, $options = array()) {
  if ($item['value'] && $item['provider']) {
    $code = $item['value'];
    $width = isset($options['width']) ? $options['width'] : $field['widget']['thumbnail_width'];
    $height = isset($options['height']) ? $options['height'] : $field['widget']['thumbnail_height'];
    $link = isset($options['thumbnail_link']) ? $options['thumbnail_link'] : $field['widget']['thumbnail_link'];
    if ($link == EMIMAGE_LINK_CONTENT) {
      $link = 'node/' . $node->nid;
    }
    else {
      if ($link == EMIMAGE_LINK_PROVIDER) {
        $link = module_invoke('emfield', 'include_invoke', 'emimage', $item['provider'], 'embedded_link', $code, $item['data']);
      }
      else {
        if (!is_string($link)) {
          $link = NULL;
        }
      }
    }
    if (isset($options['title'])) {
      $title = $options['title'];
    }
    else {
      $title = module_invoke('emfield', 'include_invoke', 'emimage', $item['provider'], 'image_title', $code, $item['data']);
    }
    $output = theme('emimage_image', $field, $item, $formatter, $node, $code, $width, $height, $title, $link, $options);
  }
  return $output;
}