theme_image

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE)

Return a themed image.

Übergabeparameter

$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.

Rückgabewert

A string containing the image tag.

Verwandte Themen

Code

includes/theme.inc, line 1274

<?php
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) . '" ' . (isset($image_attributes) ? $image_attributes : '') . $attributes . ' />';
  }
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen