src/Tweeper.php: fix rendering Instagram images in some feed readers
[tweeper.git] / src / rss_converter_instagram.com.xsl
index 01bd3d1..71b60a7 100644 (file)
@@ -25,6 +25,7 @@
 
     <xsl:param name="generate-enclosure"/>
     <xsl:param name="show-usernames"/>
+    <xsl:param name="show-multimedia"/>
 
     <xsl:output method="xml" indent="yes"/>
 
@@ -65,6 +66,7 @@
 
     <xsl:template match="//edges/node">
         <xsl:variable name="item-content-image" select="./display_url"/>
+        <xsl:variable name="item-content-image-data" select="php:functionString('Tweeper\Tweeper::generateDataURL', $item-content-image)"/>
         <xsl:variable name="item-content-caption" select="./edge_media_to_caption/edges/node/text"/>
         <xsl:variable name="item-permalink" select="concat($BaseURL, '/p/', ./shortcode, '/')"/>
         <item>
                     </xsl:if>
                     <xsl:value-of select="$item-content-caption"/>
                 </p><br />
-                <a href="{$item-permalink}"><img src="{$item-content-image}" style="max-width: 100%"/></a>
+                <xsl:if test="$show-multimedia = 1">
+                    <a href="{$item-permalink}"><img src="{$item-content-image-data}" style="max-width: 100%"/></a>
+                </xsl:if>
                 <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
             <xsl:if test="$generate-enclosure = 1">