Forums / Setup & design / Gettting at an image URL

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

eZ debug

Timing: Jan 20 2025 03:25:05
Script start
Timing: Jan 20 2025 03:25:05
Module start 'content'
Timing: Jan 20 2025 03:25:05
Module end 'content'
Timing: Jan 20 2025 03:25:05
Script end

Main resources:

Total runtime0.1698 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 590.0859180.8359
Module start 'content' 0.00690.0069 770.921997.8984
Module end 'content' 0.01380.1559 868.8203526.1484
Script end 0.1697  1,394.9688 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00372.1955200.0002
Check MTime0.00150.8772200.0001
Mysql Total
Database connection0.00150.906610.0015
Mysqli_queries0.122372.02141410.0009
Looping result0.00130.79491390.0000
Template Total0.155591.610.1555
Template load0.00090.529110.0009
Template processing0.154691.076510.1546
Override
Cache load0.00060.364610.0006
Sytem overhead
Fetch class attribute can translate value0.00100.569010.0010
XML
Image XML parsing0.00020.144210.0002
General
dbfile0.00432.5081200.0002
String conversion0.00000.004130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs