Same name and namespace in other branches
- 4.7.x includes/theme.inc \theme_image()
- 5.x includes/theme.inc \theme_image()
- 6.x includes/theme.inc \theme_image()
- 7.x includes/theme.inc \theme_image()
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
6 theme calls to theme_image()
- system_theme_listing in modules/
system.module - Generate a list of all the available theme/style combinations.
- system_user in modules/
system.module - Implementation of hook_user().
- tablesort_header in includes/
tablesort.inc - Format a column header.
- theme_user_picture in modules/
user.module - watchdog_overview in modules/
watchdog.module - Menu callback; displays a listing of log messages.
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) . '" />';
}
}