i have an image to display in view, when i put it in public/assets/img folder and writing in view(.phtml) enclosed code it works:
<img src="/assets/img/logo.jpg" width="150" height="150" class="img-circle pull-left" alt="<?= $fournisseur->intitule ?>" />
I want to put the images in data/img folder and display it in my view, how can i display it in view i tried with thise code, deleting data in path but no image view:
<img src="/data/img/logo.jpg" width="150" height="150" class="img-circle pull-left" alt="<?= $fournisseur->intitule ?>" />
i thought to create a controller for image:
public function imageAction()
{
/** get id by url **/
$imageContent = file_get_contents('./data/img/logo.jpg');
/** set file to reponse **/
$response->setContent($imageContent);
/** creat header **/
$response
->getHeaders();
return $response;
}
in view :
<img src=<?=$this->url('fourni',array('action' => 'image');?>class="img-rounded" alt="image" width="50" height="50">