theme_image

5 theme.inc theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE)
6 theme.inc theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE)
7 theme.inc theme_image($variables)
8 theme.inc theme_image($variables)

Return a themed image.

Parameters

$path: The path of the image file.

$alt: The alternative text for text-based browsers.

$title: The title text is displayed when the image is hovered in some popular browsers.

$attr: Attributes placed in the img tag.

$getsize: If set to true, the image's dimension are fetched and added as width/height attributes.

Return value

A string containing the image tag.

Related topics

8 theme calls to theme_image()

File

includes/theme.inc, line 473
The theme system, which controls the output of Drupal.

Code

function theme_image($path, $alt = '', $title = '', $attr = '', $getsize = true) {
  if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) {
    return '<img src="' . check_url($path) . '" ' . $attr . ' alt="' . check_plain($alt) . '" title="' . check_plain($title) . '" />';
  }
}
Login or register to post comments