Question

I'm new to Symfony and I'm trying to include and image (stored in the bundle Resources/public/images dir) in a twig template. When I render the page however the img tag has a non existent src path. I'm not sure what is going on, any advice would be appreciated greatly.

My Twig File

{% image '@XYZTestBundle/Resources/public/images/bananas.jpg' %}
    <img src="{{ asset_url }}" alt="Symfony!" />
{% endimage %}    

The rendered image tag

<img src="/myproject/web/images/5fcddd8.jpg" alt="Symfony!">

There are no files in the /myproject/web/images/ directory

Was it helpful?

Solution

found my answer here. I hope this helps someone else in the future

https://github.com/symfony/AsseticBundle/issues/41

OTHER TIPS

have you try the command php app/console assetic:dump or php app/console assets:install ?

otherwise I think this link can help you : http://symfony.com/doc/current/cookbook/assetic/asset_management.html

As Tali says, you should execute the command "assetic:dump" to dump your bundle assets in web folder.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top