You are here

function theme_emimage_image_preview in Embedded Media Field 6

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

Format the image using the Preview Image preset.

File

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

Code

function theme_emimage_image_preview($field, $item, $formatter, $node, $options = array()) {
  if ($item['value'] && $item['provider']) {
    $code = $item['value'];
    $width = isset($options['width']) ? $options['width'] : $field['widget']['preview_width'];
    $height = isset($options['height']) ? $options['height'] : $field['widget']['preview_height'];
    $link = isset($options['preview_link']) ? $options['preview_link'] : $field['widget']['preview_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;
}