0

I have the image in: src/WebBundle/img/img2.jpg

Im trying this but don´t works:

<img src="{{ asset('WebBundle/img/img2.jpg') }}" />

Image of routes

Thank you for the patience

Alexandre Velo
  • 115
  • 1
  • 10
  • What "does not work" means? What url is generated? Is the file in `web/bundles` directory – zerkms May 13 '16 at 09:36
  • 1
    The image folder should be `src/WebBundle/Resources/public/img`, then you can use `{{ asset('bundles/web/img/img2.jpg') }}` afterwards. (Maybe you'll need to run `php app/console assets:install`) – Yoshi May 13 '16 at 09:36
  • Btw, relevant: http://stackoverflow.com/q/9500573/251311 – zerkms May 13 '16 at 09:38

1 Answers1

0

Better to user assets.

{% image '@AppBundle/Resources/public/images/example.jpg' %}
    <img src="{{ asset_url }}" alt="Example" />
{% endimage %}

In your case just change image url to avoid any url problem.

Jasmin Mistry
  • 1,459
  • 1
  • 18
  • 23