Hi, please I need help.
I need show image in Pages/img/LogAvatar.png
This line is in home.ctp:
<?php echo $this->Html->image('LogAvatar.png', ['alt' => 'picture]); ?>
And it show only text βpictureβ
Iβve had no problems with
<td><?php echo $this->Html->image('imgdogs/' . $quy->dogpic, array(
'class' => 'imgborder',
'alt' => ''
)); ?></td>
Why are your scripts and images and everything in your Pages
dir?
This should all be in your webroot according to the conventions.
See this tree to know what I mean:
/
βββ src
β βββ Template
β βββ Pages
β βββ view.ctp
β βββ home.ctp
βββ webroot
βββ css
β βββ mystyles.min.css
βββ js
β βββ whatever.min.js
βββ img
β βββ LogAvatar.png
βββ index.php
You can then load the image in your view by using this code:
<?= $this->Html->image('LogAvatar.png',['alt'=>'picture']); ?>
1 Like