I am doing 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 like text / html, when I am using the index method of the controller no problem, all files included in html has its correct content-type, the error is also happening in css.
<?phpuseapp\models\Images;ClassHome{publicfunctionindex(){include'app/views/index.php';$images=newImages();foreach($images->all()as$key=>$value){echo'<imgsrc="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.'">';
}
}
}