Forums / Setup & design / Absolute image url

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Absolute image url

Author Message

Daniel Guerrier

Friday 08 July 2005 10:50:57 am

I'm currently using this to get the url to the image in EZ

../../../../{$item.data_map.image.content[original].url}

I would much rather dynamically generate an absolute url instead of a relative.

How would I do this?

Marco Zinn

Saturday 09 July 2005 3:24:20 am

I think, there is an operator called "ezroot" for this kind of thing.

Marco
http://www.hyperroad-design.com

ludo thomas

Monday 11 July 2005 8:50:54 am

try this:

{def $site_url=ezini( 'SiteSettings', 'SiteURL', 'site.ini' )
     $img_url=$item.data_map.image.content[original].url|ezroot}


<img src={concat( $site_url, $img_url )} />

Daniel Guerrier

Monday 11 July 2005 10:45:18 am

{def} doesn't seem to work on ver 3.5
I used this instead.

{let site_url=ezini('SiteSettings','SiteURL') image_path=$item.data_map.image.content[original].url}
					{concat('http://', $site_url, '/', $image_path)}
				{/let}

Mazen Shaheed

Friday 15 July 2005 5:31:12 am

Hi, the last post by Daniel Guerrier will work fine if your SiteURL in settings/siteaccess/URSITENAME/site.ini.append is similar to this:
SiteURL=ipaddress/sitename

But if your SiteURL is SiteURL=ipaddress/sitename/index.php

Then you need to enter another line similar to this:
RootURL=ipaddress/sitename in your file: settings/siteaccess/URSITENAME/site.ini.append

and use the following code:

{let site_url=ezini('SiteSettings','RootURL') image_path=$item.data_map.image.content[original].url}

<IMG src={concat('http://', $site_url, '/', $image_path)} />

{/let}

Cheers

David Eriksson

Friday 15 July 2005 7:23:47 am

What's wrong with using ezurl?

http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_operators/urls/ezurl

/David

Łukasz Serwatka

Saturday 16 July 2005 3:44:11 am

I suggest to display full path to image with ezroot operator. Use

{$node.data_map.image.content[original].url|ezroot}

Output:

/var/news/storage/images/media/images/banners/etiam_convallis/482-1-eng-GB/etiam_convallis.jpg

In XHTML code just place tpl code in src attribute of img tag

<img src={$node.data_map.image.content[original].url|ezroot} />

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog