7.4.1.6 image
image(string $path, array $htmlAttributes = array())
Creates a formatted image tag. The path supplied should be relative to /app/webroot/img/.
<?php echo $this->Html->image('cake_logo.png', array('alt' => 'CakePHP'))?>
<?php echo $this->Html->image('cake_logo.png', array('alt' => 'CakePHP'))?>
Will output:
<img src="/img/cake_logo.png" alt="CakePHP" />
To create an image link specify the link destination using the url option in $htmlAttributes.
<?php echo $this->Html->image("recipes/6.jpg", array(
"alt" => "Brownies",
'url' => array('controller' => 'recipes', 'action' => 'view', 6)
)); ?>
<?php echo $this->Html->image("recipes/6.jpg", array("alt" => "Brownies",'url' => array('controller' => 'recipes', 'action' => 'view', 6))); ?>
Will output:
<a href="/recipes/view/6">
<img src="/img/recipes/6.jpg" alt="Brownies" />
</a>


























