I am trying to preview images which stored inside mybundle/image folder. but i can not get proper image path for view images which name is dynamic. here is the code.
// inController
$image = $this->get('file_locator');
$path = $image->locate('@AcmeMyBundle/uploads/images/my_img.jpg');
return $this->render('images/myaction.html.twig', array(
'path'=>$path,
));
//in myaction.html.twig
{% image '@SeStorageBundle/uploads/images/'{{ image.name }} %}
<img src="{{ asset_url }}" width="100%" height="100%" alt="my alt of image" class="pull-left">
{% endimage %}
If the link to your image is correct, then try using asset
to render the image like this:
<img src ="{{asset(path)}}"/>