How to get the full url for an asset in Controller?

前端 未结 15 2130
悲&欢浪女
悲&欢浪女 2020-12-12 16:13

I need to generate some JSON content in controller and I need to get the full URL to an uploaded image situated here : /web/uploads/myimage.jpg.

How can

15条回答
  •  离开以前
    2020-12-12 16:57

    The @Al Jey solution works fine with Assetic (tested on Symfony 2.6)

    {% image '@AcmeBundle/Resources/public/images/myimage.jpg' %} 
         
    {% endimage %}
    

提交回复
热议问题