Knowledge Base > Syndication Services > Editor's Desk and Widgets
Search the Knowledge Base
 
Date Modified
Tuesday, April 08, 2008
Displaying thumbnail images for article posts

 

Widgets allow you to extract thumbnail images from RSS feeds to display along with articles. First make sure to select a feed that contains images in separate tags (not inside the post <description> element), specifically ones that are sized for the purpose of displaying as thumbnails. You can open a feed's source XML in a browser window and look for these tags somewhere around the other post specific tags, like <link> and <description>.

The image references should be contained within MediaRSS tags, like <media:thumbnail> or <media:content>. Since images are often put into non-standard tags like <image> tags, it should be noted that these images cannot be retrieved for display in the widget. So the feed must correctly utilize some type of <media: > tag in order for the image to display in the widget.

For more information on MediaRSS standards, please visit http://search.yahoo.com/mrss


Log in to Editor's Desk and navigate to the Template HTML pane of the Design tab for a widget. Look for the section that displays a post (something like this):

    <td>
        <a href="${Post.HtmlUrl|html}" onclick="${AttentionClickJS(Post)}" class="ng_postTitle" 
    target="_blank" id="post_title_${Post.PostId}">
            ${Post.Title|default:"(no title)"}
        </a>
        <br />
        <span class="ng_postInfo">
   <!-- COMMON PLACE FOR THUMBNAIL IMAGES -->
            Published ${Post.PubDate|timeSince} 
    ${Post.Author|default:Post.FeedName|prefix:"from "}
        </span>
    </td>
This is the area where you want to place a thumbnail image tag.


The two most common ways of displaying MediaRSS thumbnail images are outlined below. Since a post may not have an image associated with it, it is good practice to perform a check before attempting to display anything.

1. XML - Image declared in feed:
    <media:thumbnail alt="My Image" height="60" url="http://imagehost/myimage.jpg" width="60" />

  Editor's Desk - Check if image is present and if there is, display it:
      {if (Post.MediaRSS && Post.MediaRSS.Thumbnails[0] && Post.MediaRSS.Thumbnails[0].Url )}
        <img src="${Post.MediaRSS.Thumbnails[0].Url|html}">
      {/if}


2. XML - Image declared in feed:
    <media:content url="http://imagehost/myimage.jpg" type="image/jpeg" />

  Editor's Desk - Check if image is present and if there is, display it:
      {if Post.MediaRSS && Post.MediaRSS.Contents[0] && Post.MediaRSS.Contents[0].Url && Post.MediaRSS.Contents[0].Type=="image/jpeg"}
        <img src="${Post.MediaRSS.Contents[0].Url}">
      {/if}


If you have additional questions, or need personalized help on this topic, please send an email to Syndication Services Support.


Knowledge Base Software - myKB.com