Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • BarneyHall 141 posts 210 karma points
    Mar 16, 2012 @ 16:16
    BarneyHall
    0

    Adding a thumbnail image to RSS

    Hi folks,

    I wanted to add a thumbnail image to each item in the RSS feed.

    I imagine I need to include something along the lines of:

    var thumbnail = item.thumbImage *what do I put here?*

    And then add the variable to the line that lists the items:

    // Add the SyndicationItem to the list
    var syndicationItem = new SyndicationItem(title, thumbnail, content, itemAlternateLink) {Id = itemAlternateLink.AbsoluteUri };

    But I'm not sure how to encode the image where the thumbnail variable is defined?

    Would anyone be able to give me a pointer here?

    Many thanks (as ever!),
    Barney

     

  • Damiaan 442 posts 1301 karma points MVP 6x c-trib
    Mar 19, 2012 @ 18:40
    Damiaan
    0

    I guess the thumbnail is just a URL.

    in razor you would write something like this:

    var image = Model.MediaById(item.Id);
    if (image.GetType() != typeof(DynamicNull)) {
        thumbnail = image.Url;
    }

     

  • BarneyHall 141 posts 210 karma points
    Mar 20, 2012 @ 15:20
    BarneyHall
    0

    Hi Damiaan,

    Thanks ever so much for your reply.

    Unfortunately it didn't work. I think it's because there's a method defined elsewhere.

    Going to have to have a rethink here...

    Cheers for your help.

    Barney

Please Sign in or register to post replies

Write your reply to:

Draft