2

I want to include full asset URLs in my page templates, mainly so the Behat failed test page grabs still display properly. I've read this question, which suggests using absolute_url() as of 2.7, however I'm using the {% stylesheets %} or {% image %} tags to filter my assets.

Can anyone advise if there's a better way than doing something like this...

{% image
'@AcemBundle/Resources/public/imgs/logo.jpg'
output='compiled/imgs/logo.jpg' %}
<img src="{{ app.request.getSchemeAndHttpHost() ~ asset_url }}" alt="Logo"/>
{% endimage %}

... ?

Updated

Added full {% image %} tag I'm using.

Community
  • 1
  • 1
TobyG
  • 1,692
  • 3
  • 21
  • 36

1 Answers1

-1

Use it like this:

<img src="{{ asset('bundles/mybundle/assets/img/logo.png') }}">
Reformat Code
  • 307
  • 1
  • 3
  • But does that apply the filters as the {% image %} tag does? I'll update me question to demonstrate how I'm using it. – TobyG Oct 26 '15 at 15:19
  • If you use it as my code you dont need the {% image %} tag. – Reformat Code Oct 27 '15 at 08:00
  • But I want to apply the filter to the image (which I missed off my example). This example doesn't apply the filter, does it? – TobyG Oct 27 '15 at 10:05