Topic on Extension talk:RSS

Showing images into rss feeds

3
Lumber Jack second account (talkcontribs)

I have RSS feed 2.25.0 installed, with a MediaWiki 1.23.5.

I am trying to get images to be shown in RSS feeds that I have added to a Wiki and I have not figured it out.

So lets say I create a Wiki page for an organisation that also has a Facebook page. Lets say Wikipedia has a Facebook page.

Through findmyfacebookid.com I find out that Wikipedia's Facebook ID is 33138223345.

I can add that number to the back of https://www.facebook.com/feeds/page.php?format=rss20&id='' to get https://www.facebook.com/feeds/page.php?format=rss20&id=33138223345 which is the RSS feed of Wikipedia on Facebook.

so far so good,

now I go back to my wiki and add that feed between <rss>-tags, so it shows as such

 <rss max="16">https://www.facebook.com/feeds/page.php?format=rss20&id=33138223345</rss>
 

and it looks pretty good, except when there are images included in the RSS feed posts, they are not shown, just a html code is shown

e.g. this image

of Armenia's Wiki Camp shows up like this in the feed section of my wiki:

 <img class="img" src="https://fbexternal-a.akamaihd.net/safe_image.php?d=AQAbFMb77DTthF-D&w=158&h=158&url=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2Fe%2Fe9%2FWiki_camp_Armenia_2014_flash_mob.png%2F580px-Wiki_camp_Armenia_2014_flash_mob.png" alt="" />  


well that is not that sexy, I want some feeds with images as eye candy, they get more clicks/attention/love.

  1. So I figure, I need to go into RSS.php file and set the parameter $wgRSSAllowLinkTag = true; and $wgRSSAllowImageTag = true; it still doesn't work
  2. maybe my wiki doesn't allow external images? so I follow the Manual:$wgAllowExternalImages instructions and add that with $wgAllowExternalImages = true; it still doesn't work
  3. The code itself is html, I check if it would work to just add <html>-tags around the <rss>-tags, doesn't work
  4. I copy the code out of the feed and add tags below separately
     <html> <img class="img" src="https://fbexternal-a.akamaihd.net/safe_image.php?d=AQAbFMb77DTthF-D&w=158&h=158&url=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2Fe%2Fe9%2FWiki_camp_Armenia_2014_flash_mob.png%2F580px-Wiki_camp_Armenia_2014_flash_mob.png" alt="" />  </html>
    which renders the image after I set $wgRawHtml=true; see Manual:$wgRawHtml that works, but doesn't help me
  5. what if I set the Manual:$wgAllowImageTag to $wgAllowImageTag=true;, now I don't need to set <html>-tags around <img>-tags and the images are shown but not in the rss feeds. doesn't work
  6. What if I can add <html>-tags into the subelements of the template for the extension, directly into MediaWiki:Rss-item? The description is where the image are that I pulled from Facebook, so if I add <html>-tags around that parameter?
     {{$1 | title = {{{title}}} | link = {{{link}}} | date = {{{date}}} | author = {{{author}}} | description = <html>{{{description}}}</html> }}
    doesn't work. Maybe around the whole template?
     <html>{{$1 | title = {{{title}}} | link = {{{link}}} | date = {{{date}}} | author = {{{author}}} | description = {{{description}}} }}</html>
    doesn't work.
  7. Then I read through this Thread:Project:Support_desk/template_variables_within_html_tags. So you need to add
     {{#tag:html| }} 
    around the parameters.
     {{$1 | title = {{{title}}} | link = {{{link}}} | date = {{{date}}} | author = {{{author}}} | description = {{#tag:html| {{{description}}} }} }}
    doesn't work. Maybe like this?
     {{$1 | title = {{{title}}} | link = {{{link}}} | date = {{{date}}} | author = {{{author}}} | {{#tag:html| description =  {{{description}}} }} }}
    doesn't work. Around the whole thing?
     {{#tag:html| {{$1 | title = {{{title}}} | link = {{{link}}} | date = {{{date}}} | author = {{{author}}} | description =  {{{description}}} }} }}
    doesn't work.
  8. Am I changing the wrong template? Maybe the MediaWiki:Rss-feed instead? there I change the source to
    ; '''<span class='plainlinks'>[{{{link}}} {{{title}}}]</span>''' : {{#tag:html| {{{description}}} }} : {{{author}}} {{{date}}} 
    doesn't work. Different
     ; {{#tag:html| '''<span class='plainlinks'>[{{{link}}} {{{title}}}]</span>''' : {{{description}}} : {{{author}}} {{{date}}} }}
    doesn't work.


I don't know what else I could do? Maybe take earlier version of the extension? If anyone could help me here I would be grateful.

here a thread on phabricator with the same issue Sanitizer fails to include image tags if incorrectly written as closed/void tags -LumberJack

CayceP (talkcontribs)

Not sure if OP was able to resolve their issue, but in case someone else is having issues displaying image in MW 1.30.0+ try this:

in \extensions\RSS\RSSParser.php remove this part at line 485 if ( isset( $wgRSSAllowImageTag ) && $wgRSSAllowImageTag ) { $extraInclude[] = "img"; } else { $extraExclude[] = "img"; }

This is the part that skips the rendering of any images. Usually it is not required to modify your RSS template e.g. something like } [{{{link}}} {{{title}}}]
{{{description}}}
should display the images if $wgRSSAllowImageTag is set to true in your LocalSettings.php

171.4.218.5 (talkcontribs)

Hi, I am also having an issue showing images, and have followed the instructions above and in the docs. I posted a question on Stack Overflow, and will respond back here if I am able to figure it out. Thanks for any tips on this config! :D

.../questions/76098396/mediawiki-rss-extension-not-showing-images

Reply to "Showing images into rss feeds"