You are here

function image_display in Image 5.2

Same name and namespace in other branches
  1. 5 image.module \image_display()
  2. 6 image.module \image_display()

Create an <img> tag for an image.

16 calls to image_display()
image_attach_block in contrib/image_attach/image_attach.module
Implementation of hook_block().
image_attach_form_alter in contrib/image_attach/image_attach.module
implementation of hook_form_alter()
image_attach_views_handler_field_iid in contrib/image_attach/image_attach.module
Views handler for displaying the image.
image_attach_views_handler_field_iid_link_image in contrib/image_attach/image_attach.module
Views handler for displaying the image in a link to the attached image.
image_attach_views_handler_field_iid_link_node in contrib/image_attach/image_attach.module
Views handler for displaying the image in a link to the image node that attaches the image.

... See full list

File

./image.module, line 799

Code

function image_display(&$node, $label = IMAGE_PREVIEW, $attributes = array()) {
  if (empty($node->images[$label])) {
    return;
  }
  $image_info = image_get_info(file_create_path($node->images[$label]));
  $attributes['class'] = "image image-{$label} " . (isset($attributes['class']) ? $attributes['class'] : "");

  // Only output width/height attributes if image_get_info() was able to detect
  // the image dimensions, since certain browsers interpret an empty attribute
  // value as zero.
  if (!empty($image_info['width'])) {
    $attributes['width'] = $image_info['width'];
  }
  if (!empty($image_info['height'])) {
    $attributes['height'] = $image_info['height'];
  }
  return theme('image_display', $node, $label, file_create_url($node->images[$label]), $attributes);
}