lithium\template\helper\Html::image()

public method

Creates a formatted <img /> element.

Parameters

  • string $path

    Path to the image file. If the filename is prefixed with '/', the path will be relative to the base path of your application. Otherwise the path will be relative to the images directory, usually webroot/img/. If the name starts with 'http://', this is treated as an external url used as the src attribute.

  • array $options

    Array of HTML attributes.

Returns

string

Returns a formatted <img /> tag.

Filter

This method can be filtered.

Source

	public function image($path, array $options = []) {
		$defaults = ['alt' => ''];
		$options += $defaults;
		$path = is_array($path) ? $this->_context->url($path) : $path;

		$params = compact('path', 'options');
		$m = __METHOD__;

		return Filters::run($this, __FUNCTION__, $params, function($params) use ($m) {
			return $this->_render($m, 'image', $params);
		});
	}