You are here

function image_display in Image 6

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

Create an <img> tag for an image.

11 calls to image_display()
image_attach_form_alter in contrib/image_attach/image_attach.module
Implementation of hook_form_alter().
image_form_add_thumbnail in ./image.module
image_gallery_handler_field_gallery_cover_thumbnail::render in contrib/image_gallery/views/image_gallery_handler_field_gallery_cover_thumbnail.inc
Returns field html.
image_handler_field_image_node_image::render_html in views/image_handler_field_image_node_image.inc
Return image html, using image_load() and image_display().
theme_image_attach_attached_images in contrib/image_attach/image_attach.module
Generic theme function for any set of attached images.

... See full list

File

./image.module, line 633

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);
}