Gettting at an image URL

Author Message

Deane Barker

Thursday 14 October 2004 3:38:15 pm

How do you get at the URL for the image in an image datatype? I have a loop to get all the image children of my node, but when it comes to forming the IMG HTML tag, I'm at a loss for where to find the image.

What is the attribute that would contain the URL to the image file? This doesn't work:

img src="{$:item.object.data_map.image.?}"

The attribute is "image." But I assume the actual path of the image is some kind of sub-datatype of that? How do I get at the path?

Deane

Lazaro Ferreira

Thursday 14 October 2004 4:27:05 pm

Hi,

Try this

img src={$:item.object.data_map.image.content.url|ezroot}

or this

{let myimage=$:item.object.data_map.image.content['original']}
....
<img src={$myimage.url|ezroot} />
.....
{/let}

Lazaro
http://www.mzbusiness.com

Deane Barker

Thursday 14 October 2004 8:41:08 pm

Neither option worked. The first one just output two double quotes (""), and the second did nothing. Here's all the code I'm working with:

{let images=fetch(	'content', 
			'list', 
			hash(	'parent_node_id', $node.node_id,
				'class_filter_type',  'include',
				'class_filter_array', array('image' ) ) )}
{section name=images loop=$images}
{$:item.object.data_map.image.content.url|ezroot}
{/section}
{/let}

As you can see, I'm just trying to print the URL for now. When I can do that, I'll put it in the IMG tag.

I'm confused about the ".content" part of the path. Is "content" a sub-part of any attribute? Or just image attributes? For instance, for the first name, I just have to do:

$node.object.data_map.fname

Does the text datatype have a "content" sub-part?

Deane

Lazaro Ferreira

Friday 15 October 2004 1:37:15 am

Hi,

As far as I know some attributes have this

content

property , i.e: image, binary file

Have you enabled your debug output, and clear all of your cache before testing your changes ?

Lazaro
http://www.mzbusiness.com

Martin Ulrich

Friday 15 October 2004 3:12:55 am

I dont know if this helps. I do not know much about code writing, but in my slideshow I loop the imagepaths:

{section name=Child loop=$slide}
{$Child:item.data_map.image.content[large].full_path}
{/section}

Sebastian

_______________________

http://artenic.de ARTENIC - Publishing mit allen Mitteln!

Deane Barker

Friday 15 October 2004 7:17:20 am

Thanks -- with a little fiddling, I got this:

{$Child:item.data_map.image.content[large].url|ezurl}

That does it. I'm still not sure about the part of the path that starts ".content", but I'm not complaining that this problem is solved.

Deane

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 18 2025 16:01:50
Script start
Timing: Jan 18 2025 16:01:50
Module start 'layout'
Timing: Jan 18 2025 16:01:50
Module start 'content'
Timing: Jan 18 2025 16:01:51
Module end 'content'
Timing: Jan 18 2025 16:01:51
Script end

Main resources:

Total runtime0.8073 sec
Peak memory usage4,096.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0086 589.0469152.6250
Module start 'layout' 0.00860.0028 741.671939.4453
Module start 'content' 0.01140.7945 781.1172604.0078
Module end 'content' 0.80590.0014 1,385.125016.1641
Script end 0.8073  1,401.2891 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.3899160.0002
Check MTime0.00140.1729160.0001
Mysql Total
Database connection0.00120.143410.0012
Mysqli_queries0.744892.2608680.0110
Looping result0.00070.0840660.0000
Template Total0.775196.020.3875
Template load0.00160.199420.0008
Template processing0.773495.801920.3867
Template load and register function0.00010.013310.0001
states
state_id_array0.00100.126210.0010
state_identifier_array0.00150.190020.0008
Override
Cache load0.00140.1752400.0000
Sytem overhead
Fetch class attribute can translate value0.00060.076630.0002
Fetch class attribute name0.00120.142970.0002
XML
Image XML parsing0.00070.089830.0002
class_abstraction
Instantiating content class attribute0.00000.002690.0000
General
dbfile0.00080.1025160.0001
String conversion0.00000.001140.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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
8content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.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: 6

Time used to render debug report: 0.0001 secs