开发者

Yahoo' RSS <media:content> doesnt display image thumbnail

I need to make thumbnails available in RSS, i.e. show pictures in RSS. I started to use Yahoo' Media RSS module. Good documentation, good examples. Ok.

Here is my snippet of RSS' xml and__ it doesn't show pictures:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <link>http://localhost:8080/dir/jrOreAeH/Pictures.html</link>
        <item>
            <title>Winter.jpg</title>
            <link>http://localhost:8080/photo/iZ0Omnkt/Winter.html</link>
            <media:content fileSize="105542" height="100"
                url="http://localhost:8080/img/37/f5b44ca3/Winter.jpg?sizeM=2" width="100"/>
            <pubDate>25/10/2010</pubDate>
        </item>
        <item>
            <title>Edge.jpg</title>
            <link>http://localhost:8080/photo/yfLmrjtu/Edge.html</link>
            <media:content fileSize="28521" height="100"
                url="http://localhost:8080/img/38/650b5132/Edge.jpg?sizeM=2" width="100"/&g开发者_开发知识库t;
            <pubDate>25/10/2010</pubDate>
        </item>
    </channel>
</rss>

I believe xml is correct and images should be displayed, but in fact - is not. So, what's wrong?!


I have use this one working properly:

<media:thumbnail url="http://localhost:8080/img/38/650b5132/Edge.jpg?sizeM=2" />
<media:content url="http://localhost:8080/img/38/650b5132/Edge.jpg?sizeM=2" />


Try nesting the element inside the ..

Then if you are viewing the rss in a browser, the media elements sometimes do not show by default, view the source to see if your media elements are there.

You might have to use a php or asp script to turn the Rss into an XMLDocumnet object then in php you can echo your html and feed variables.. for asp I had to call in a an XSL stylesheet to display the elements how you want..

ASP script to turn rss into dom doc..

XSL Stylesheet sample..

    <xsl:variable name="title" select="title" />
    <xsl:variable name="description" select="description" />
    <xsl:variable name="thumb" select="media:content/media:thumbnail/@url" />

    <p class="bold"><a style="text-decoration: none"><xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute><xsl:value-of select="$title" disable-output-escaping="yes"/></a></p>
    <p><xsl:value-of select="$description" disable-output-escaping="yes"/></p>
    <img src="{$thumb}" alt="{$title}"/>
</xsl:if>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜