Displaying images in atom feed

一个人想着一个人 提交于 2019-12-07 02:30:28

问题


I have problems with displaying images in atom file. It doesn't include images in feed in google reader, opera or firefox.

As a starting point I did everything like in Listing 6. at [An overview of the Atom 1.0 Syndication Format] But it doesn't work.

Update It is not problem with hotlink protected images. Described here: How to display item photo in atom feed?

Later I changed feed according to description posted here.

I added:

<media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="path_to_image.jpg" />

But still it doesn't work


回答1:


I had the same problem when trying to include images as enclosure, but it seemed that the easiest way for me was to include the image with the normal img tag to the html content.

(It's also wrapped in CDATA, which might affect the way Google Reader handles the content. I haven't tried without.)

The following example works for me to make atom feed images visible in Google Reader:

<content type="html">
  <![CDATA[
    <a href="http://test.lvh.me:3000/listings/341-test-pics?locale=en">
      <img alt="test_pic" src="http://test.lvh.me:3000/system/images/20/medium/test_pic.jpg?1343246102" />
    </a>
  ]]>
</content>


来源:https://stackoverflow.com/questions/11110481/displaying-images-in-atom-feed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!