雅虎的RSS <媒体:内容>不显示图像缩略图</media:content>

时间:2010-05-25 13:35:21

标签: mediarss

我需要在RSS中提供缩略图,即在RSS中显示图片。我已开始 使用Yahoo'Media RSS模块。良好的文档,良好的例子。确定。

这是我的RSS片段'xml和___它没有显示图片:

<?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"/>
            <pubDate>25/10/2010</pubDate>
        </item>
    </channel>
</rss>

我相信xml是正确的,应该显示图像,但事实上 - 不是。那么,怎么了?!

2 个答案:

答案 0 :(得分:2)

我使用这个正常工作:

<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" />

答案 1 :(得分:0)

 尝试将元素嵌套在..

          

然后,如果您在浏览器中查看rss,默认情况下有时不会显示媒体元素,请查看来源以查看您的媒体元素是否存在。

您可能必须使用php或asp脚本将Rss转换为XMLDocumnet对象  在PHP中你可以回显你的html和feed变量..对于asp我必须在一个XSL样式表中调用以显示你想要的元素..

用于将rss转换为dom doc的ASP脚本..

XSL样式表示例..

   

    

    <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>