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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 08:08:12
Script start
Timing: Jan 31 2025 08:08:12
Module start 'layout'
Timing: Jan 31 2025 08:08:12
Module start 'content'
Timing: Jan 31 2025 08:08:13
Module end 'content'
Timing: Jan 31 2025 08:08:13
Script end

Main resources:

Total runtime1.1772 sec
Peak memory usage4,096.0000 KB
Database Queries77

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0040 588.1094151.1953
Module start 'layout' 0.00400.0023 739.304736.6172
Module start 'content' 0.00631.1699 775.92191,128.4766
Module end 'content' 1.17620.0009 1,904.398415.8750
Script end 1.1771  1,920.2734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00270.2308160.0002
Check MTime0.00120.1039160.0001
Mysql Total
Database connection0.00060.051410.0006
Mysqli_queries1.110194.3017770.0144
Looping result0.00070.0604750.0000
Template Total1.147797.520.5738
Template load0.00190.157420.0009
Template processing1.145897.335920.5729
Template load and register function0.00130.107710.0013
states
state_id_array0.00150.130810.0015
state_identifier_array0.00150.124220.0007
Override
Cache load0.00160.1360400.0000
Sytem overhead
Fetch class attribute can translate value0.00070.059360.0001
Fetch class attribute name0.00200.1734100.0002
XML
Image XML parsing0.00320.270260.0005
class_abstraction
Instantiating content class attribute0.00000.0016100.0000
General
dbfile0.00310.2659300.0001
String conversion0.00000.000540.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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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