Forums / Setup & design / Absolute image url

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

eZ debug

Timing: Jan 18 2025 22:31:56
Script start
Timing: Jan 18 2025 22:31:56
Module start 'content'
Timing: Jan 18 2025 22:31:57
Module end 'content'
Timing: Jan 18 2025 22:31:57
Script end

Main resources:

Total runtime1.0349 sec
Peak memory usage4,096.0000 KB
Database Queries78

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 588.7422180.8438
Module start 'content' 0.00651.0243 769.5859737.7813
Module end 'content' 1.03070.0042 1,507.367246.1328
Script end 1.0349  1,553.5000 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3074140.0002
Check MTime0.00140.1399140.0001
Mysql Total
Database connection0.00050.051810.0005
Mysqli_queries0.979894.6698780.0126
Looping result0.00080.0780760.0000
Template Total1.007897.420.5039
Template load0.00230.218920.0011
Template processing1.005597.159120.5028
Template load and register function0.00010.012710.0001
states
state_id_array0.00090.082210.0009
state_identifier_array0.00100.093120.0005
Override
Cache load0.00200.1928400.0000
Sytem overhead
Fetch class attribute can translate value0.00070.069560.0001
Fetch class attribute name0.00100.1010100.0001
XML
Image XML parsing0.00200.190560.0003
class_abstraction
Instantiating content class attribute0.00000.0016100.0000
General
dbfile0.00120.1131320.0000
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 32
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs