Forums / Setup & design / Show embeded image as thumbnail

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