This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » eZ Publish 5 Platform » Get absolute url of an image...
expandshrink

Get absolute url of an image attribute of a class

Get absolute url of an image attribute of a class

Tuesday 10 June 2014 7:02:10 pm - 1 reply

I have a class with an image attribute.

Within the twig template, I can get the relative url (e.g. '/var/site/storage/image/...') from the attribute parameters.

Now I need the absolute url. Which is the best way to get it?

Should I get the request information and append the base url to the relative one? Or there's a built in method for that?

Thanks

Wednesday 11 June 2014 9:40:14 am

Hi John

You need to use the Request object for that. Example in a Twig template:

{{ app.request.schemeAndHttpHost ~ asset( "var/site/storage/image/..." ) }}

Modified on Wednesday 11 June 2014 9:41:37 am by Jérôme Vieilledent

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from