在Rss或Atom-feeds中使用data-uri嵌入图像

时间:2016-07-12 20:17:31

标签: xml rss atom-feed data-uri

我可能会问这个显而易见的问题,但是可以使用数据URI来嵌入RSS或原子提要中的图像吗?

(如果我将它们嵌入以使馈送器理解?)

实施例

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<image>
      <url><![CDATA[data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==]]></url>
      <title>Spain.info</title>
      <width>48</width>
      <height>48</height>
      <link>https://en.wikipedia.org/wiki/Data_URI_scheme</link>
    </image>
    <title>Data URI scheme</title>
    <atom:link href="https://en.wikipedia.org/wiki/Data_URI_scheme" rel="self" type="application/rss+xml" />
    <link>https://en.wikipedia.org/wiki/Data_URI_scheme</link>
    <description>Data URI scheme</description>
    <lastBuildDate>Tue, 12 Jul 2016 19:49:39 +0000</lastBuildDate>
    </channel>
</rss>

1 个答案:

答案 0 :(得分:0)

您建议的代码在 iPhone 播客中对我来说效果很好(尽管 5x5 图像显示得非常大且模糊)。

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<image>
      <url><![CDATA[data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==]]></url>
      <title>Spain.info</title>
      <width>48</width>
      <height>48</height>
      <link>https://en.wikipedia.org/wiki/Data_URI_scheme</link>
    </image>
    <title>Data URI scheme</title>
    <atom:link href="https://en.wikipedia.org/wiki/Data_URI_scheme" rel="self" type="application/rss+xml" />
    <link>https://en.wikipedia.org/wiki/Data_URI_scheme</link>
    <description>Data URI scheme</description>
    <lastBuildDate>Tue, 12 Jul 2016 19:49:39 +0000</lastBuildDate>
    </channel>
    <item>
      <title>Black and White Rag - Winifred Atwell</title>
      <description>Early rare stereo version by Winifred  Atwell, used Lenco L85 turntable with Grace F9E cartridge.</description>
      <link>https://archive.org/details/BlackAndWhiteRag-383</link>
      <pubDate>03 May 2021 00:00</pubDate>
      <enclosure url="https://ia800209.us.archive.org/7/items/BlackAndWhiteRag-383/BlackAndWhiteRagWinifredAtwell.mp3" type="audio/mpeg" />
    </item>
</rss>```