Show embeded image as thumbnail

Author Message

James Ward

Wednesday 20 April 2005 8:17:52 am

I am trying to make a failover for the article thumbnail image. If no thumbnail is present the article line template will look at the related objects of the article for any images. It should then use the first image it finds as the thumbnail. My problem is having it stop after it finds one. Currently an article containing 3 images will have three thumbnails. I aslo think there is a more efficient way of doing this.

Here is my code:

{section show=$node.object.data_map.image.content}
              {attribute_view_gui alignment=right image_class=articlethumbnail attribute=$node.object.data_map.image.content.data_map.image}
      {section-else}
        {section show=count($node.object.related_contentobject_array)|gt(0)}
            {section loop=$node.object.related_contentobject_array}
              {switch match=$item.contentclass_id}
                {case match=5}
                  {attribute_view_gui alignment=right image_class=articlethumbnail attribute=$item.data_map.image image_class=medium}
                  {*This Should Break Here*}
                {/case}
                {case}
                  {*not an image*}
                {/case}
              {/switch}
            {/section}
          {/section}
      {/section}

working at www.wardnet.com
blogging at www.jamesward.ca

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 19 2025 07:06:45
Script start
Timing: Jan 19 2025 07:06:45
Module start 'layout'
Timing: Jan 19 2025 07:06:45
Module start 'content'
Timing: Jan 19 2025 07:06:46
Module end 'content'
Timing: Jan 19 2025 07:06:46
Script end

Main resources:

Total runtime0.9941 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 589.1563152.6250
Module start 'layout' 0.00470.0035 741.781339.4609
Module start 'content' 0.00820.9844 781.2422467.5000
Module end 'content' 0.99250.0016 1,248.74228.1641
Script end 0.9941  1,256.9063 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.3166160.0002
Check MTime0.00140.1427160.0001
Mysql Total
Database connection0.00070.068210.0007
Mysqli_queries0.951695.7205460.0207
Looping result0.00050.0525440.0000
Template Total0.959996.620.4799
Template load0.00210.213120.0011
Template processing0.957796.337720.4789
Template load and register function0.00030.027010.0003
states
state_id_array0.00310.310210.0031
state_identifier_array0.00230.229520.0011
Override
Cache load0.00160.164370.0002
Sytem overhead
Fetch class attribute can translate value0.00090.089410.0009
Fetch class attribute name0.00090.090920.0005
XML
Image XML parsing0.00180.179710.0018
class_abstraction
Instantiating content class attribute0.00000.000620.0000
General
dbfile0.00310.3100160.0002
String conversion0.00000.001040.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
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/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: 6
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs