-1
I am making a foreach in the controller to test if it is returning all images the problem is that the images do not appear because the content-type is as text/html, when I am using the index method of the controller has no problem, all files included in html have their content-type correct, the error is also happening in css.
<?php
use app\models\Images;
Class Home{
public function index(){
include 'app/views/index.php';
$images = new Images();
foreach ($images->all() as $key => $value) {
echo '<img src="app/views/imgs/'.$value->name.'">';
}
}
public function add(){
$name = $_FILES['imagem']['name'];
$image = new Images();
$image->setName($name);
if($image->insert()){
$image->upload();
}
}
public function img(){
include 'app/views/index.php';
$images = new Images();
foreach ($images->all() as $key => $value) {
echo '<img src="app/views/imgs/'.$value->name.'">';
}
}
}
It must be some . htaccess in your folder, or it may be that folder
/Home/app/views/imgs/...
is incorrect– Guilherme Nascimento
Oh yes 'Home' is the controller and it’s coming before the app in the image path actually it shouldn’t even be there, the right one was just app/views/imgs/..., thank you very much for the help.
– gustavohej