Forums / Setup & design / 3.3: Getting the path to the original version of an image

3.3: Getting the path to the original version of an image

Author Message

Alex Jones

Tuesday 02 March 2004 1:04:56 pm

I am setting up some code to display a random image background. The images are to be pulled from a folder (#522) within the Media section. As I am using CSS, I need the path to the original version of the image, but am not able to generate it as simply as I would like.

The code:

{let SiteTitleHeader=fetch(content,tree,hash(parent_node_id,522,
                                             class_filter_type,include,
                                             class_filter_array, array(5)))|shuffle}
  {attribute_view_gui attribute=$SiteTitleHeader.0.data_map.image image_class=original}<br />
  1. {$SiteTitleHeader.0.data_map.image.url_alias}<br>
  2. {$SiteTitleHeader.0.data_map.image[original].url_alias}<br>
  3. {$SiteTitleHeader.0.data_map.image.content[original].full_path}
{/let}

The shuffle function works perfectly, a random image is pulled each time. But, for some reason I cannot display the path to the image which is what I really need.

I am running 3.3.

Any ideas are appreciated!

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Jan Borsodi

Thursday 04 March 2004 4:36:13 am

Your 3rd line should do the trick, you can also write it like:

{$SiteTitleHeader.0.data_map.image.content.original.url}

Do you get any errors or warnings (check debug)?

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Alex Jones

Thursday 04 March 2004 6:57:38 am

There appears to be a problem with the eZimage class, specifically within <i>ezimagealiashandler.php</i>. Here's the debug info:

<b>Warning: PHP</b>
array_merge(): Argument #2 is not an array in /x/local/www/cuttingedge.data/ez/kernel/classes/ezcontentcache.php on line 67
<b>Warning: eZModuleOperationInfo::execute </b>
Missing main operation memento for key: ba704d646a75aca8247559105204c14e
<b>Warning: PHP</b>
array_merge(): Argument #2 is not an array in /x/local/www/cuttingedge.data/ez/kernel/classes/ezcontentcache.php on line 67
<b>Warning: PHP</b>
Undefined variable: nodePath in /x/local/www/cuttingedge.data/ez/kernel/classes/ezcontentobjecttreenode.php on line 906
<b>Warning: ezi18n </b>
No translation for file(translation.ts) in context(kernel/classes/datatypes): 'Image' with comment(Datatype name)
<b>Error: eZTSTranslator::loadTranslationFile</b>
Could not load translation file: share/translations/eng-US/translation.ts
<b>Warning: eZTranslationCache::setContextCache</b>
Translation cache for context 'cachecontexts' already exists
<b>Warning: ezi18n</b>
No translation for file(translation.ts) in context(kernel/classes/datatypes): 'Text line' with comment(Datatype name)
<b>Warning: PHP</b>
Undefined property: DataTypeCustom in /x/local/www/cuttingedge.data/ez/kernel/classes/datatypes/ezimage/ezimagealiashandler.php on line 588
<b>Warning: PHP</b>
Undefined variable: imageRow in /x/local/www/cuttingedge.data/ez/kernel/classes/datatypes/ezimage/ezimagealiashandler.php on line 861

Also, it will timeout if I try to use number 3, or the code Jan provided.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Alex Jones

Thursday 04 March 2004 7:38:06 am

I think I might have found the problem. After reading this bug report (http://ez.no/community/bug_reports/critical_cache_template_compile_fails_with_fatal_errors_image_troubles) I turned off template compiling. Now the code that Jan provided, and version 3 both work.

It looks like I need to upgrade to 3.3.3 from my current version of 3.3.2.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

eZ debug

Timing: Jan 18 2025 19:34:42
Script start
Timing: Jan 18 2025 19:34:42
Module start 'content'
Timing: Jan 18 2025 19:34:43
Module end 'content'
Timing: Jan 18 2025 19:34:43
Script end

Main resources:

Total runtime0.8096 sec
Peak memory usage4,096.0000 KB
Database Queries197

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0070 587.9688180.7969
Module start 'content' 0.00710.6616 768.7656564.6797
Module end 'content' 0.66870.1408 1,333.4453336.7109
Script end 0.8095  1,670.1563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.5032210.0002
Check MTime0.00170.2103210.0001
Mysql Total
Database connection0.00080.093910.0008
Mysqli_queries0.730390.21291970.0037
Looping result0.00220.27141950.0000
Template Total0.780396.420.3902
Template load0.00170.215320.0009
Template processing0.778696.171120.3893
Template load and register function0.00010.013110.0001
states
state_id_array0.00120.143910.0012
state_identifier_array0.00100.124420.0005
Override
Cache load0.00150.1810460.0000
Sytem overhead
Fetch class attribute can translate value0.00130.156630.0004
Fetch class attribute name0.00120.149760.0002
XML
Image XML parsing0.00120.152530.0004
class_abstraction
Instantiating content class attribute0.00000.001780.0000
General
dbfile0.00250.3044340.0001
String conversion0.00000.000830.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/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: 20
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs