Joomla! Programmierung/Framework/JHtml/image
Aus Joomla! Dokumentation
Gibt ein <img></img> Element aus.
Inhaltsverzeichnis |
[Bearbeiten] Syntax
static string image( $url, $alt, $attribs )
| Parameter | Datentyp | Beschreibung | Standardwert |
|---|---|---|---|
| $url | string | Die URL, zum Bild | |
| $alt | string | Der "alt"-Text des Bildes. | |
| $attribs | array() | Attribute des <image/>, müssen als Array in der Form array('name' => 'wert') übergeben werden.
|
null |
[Bearbeiten] Beispiele
[Bearbeiten] Bild ausgeben
$url = 'http://cdn.joomla.org/images/logo.png'; $alt = 'Joomla! Logo'; $attribs['width'] = '235px'; $attribs['height'] = '46px'; echo JHtml::_('image', $url, $alt, $attribs);
Ausgabe:
<img src="http://cdn.joomla.org/images/logo.png" alt="Joomla! Logo" width="235px" height="46px" />[Bearbeiten] Siehe auch
[Bearbeiten] Quellcode
{ { } $includes = self::includeRelativeFiles('images', $file, $relative, false, false); // If only path is required if ($path_only) { { return $includes[0]; } else { return null; } } else { return '<img src="' . (count($includes) ? $includes[0] : '') . '" alt="' . $alt . '" ' . $attribs . ' />'; } }