function theme_image in Drupal 4
Same name and namespace in other branches
- 5 includes/theme.inc \theme_image()
- 6 includes/theme.inc \theme_image()
- 7 includes/theme.inc \theme_image()
Return a themed image.
Parameters
$path: Either the path of the image file (relative to base_path()) or a full URL.
$alt: The alternative text for text-based browsers.
$title: The title text is displayed when the image is hovered in some popular browsers.
$attributes: Associative array of attributes to be 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
9 theme calls to theme_image()
- system_themes in modules/
system.module - Menu callback; displays a listing of all themes.
- system_theme_select_form in modules/
system.module - Returns a fieldset containing the theme select form.
- theme_aggregator_block_item in modules/
aggregator.module - Format an individual feed item for display in the block.
- theme_feed_icon in includes/
theme.inc - Return code that emits an feed icon.
- theme_forum_icon in modules/
forum.module - Format the icon for each individual topic.
File
- includes/
theme.inc, line 517 - The theme system, which controls the output of Drupal.
Code
function theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {
if (!$getsize || is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path))) {
$attributes = drupal_attributes($attributes);
$url = url($path) == $path ? $path : base_path() . $path;
return '<img src="' . check_url($url) . '" alt="' . check_plain($alt) . '" title="' . check_plain($title) . '" ' . $image_attributes . $attributes . ' />';
}
}