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.