Logo

Html->image()

ops...

Description

Creates a formatted image tag. The path supplied should be relative to webroot/img/. You HAVE to include the file extension

Usage: Cake\View\Helper\HtmlHelper::image(string $path, array $options = []) echo $this->Html->image('php-cats-logo.png'); echo $this->Html->image('php-cats-logo (1).svg', ['alt' => 'Logo', 'class' => 'img-fluid layout-default__image'] ); Output: <img src="/img/php-cats-logo.png"> <img src="/img/php-cats-logo%20%281%29.svg" alt="Logo" class="img-fluid layout-default__image"> echo $this->Html->image( "recipes/6.jpg", ["alt" => "Brownies",'url' => [ 'controller' => 'Recipes', 'action' => 'view', 6 ]] ); Output: <a href="/recipes/view/6"> <img src="/img/recipes/6.jpg" alt="Brownies" /> </a>