Creates a image link.
echo HTML::image('media/img/logo.png', array('alt' => 'My Company'));
string Core_HTML::image( string $file [, array $attributes = null , $index = bool false ] )
参数列表
参数 类型 描述 默认值 $file
string
File name $attributes
array
Default attributes null $index
unknown
bool false
string
public static function image($file, array $attributes = null, $index = false)
{
if (strpos($file, '://') === false)
{
// Add the base URL
$file = Core::url()->base($index) . $file;
}
// Add the image link
$attributes['src'] = $file;
return '<img' . HTML::attributes($attributes) . ' />';
}