I want to load pictures dynamically from database.
Here's the table containing the image informations:
Controller code
public function listeproductAction()
{
$em = $this->getDoctrine()->getManager();
$img = $em->getRepository('AppBundle:image')->findAll();
return $this->render('lucky/images.html.twig', array(
'img' => $img ,
));
}
twig code
{% for im in img %}
<img src="{{ asset('/uploads/brochures/' ~ im.getBrochure()) }} ">
{% endfor %}
result
<div class="main-content">
<img src="/uploads/brochures/0fa58c757752ced32d04b57bb7fa0d65.png ">
</div>
The problem is that asset
function doesn't find the image.