Displaying images from external RSS feeds?

Is there any way to show an image for RSS feeds in my WordPress page? Currently the default WordPress RSS feeds will only show the text of feeds from other sites. How can I make my site show a thumbnail image of RSS feeds of the other sites?

Related posts

Leave a Reply

3 comments

  1. SimplePie, which ships with WordPress, does support images in feeds. Please see the SimplePie Reference if you need to look for specific functions regarding images.

    If you want to display images from feeds on your own site, you could for example create a plugin containing a custom widget that reads a feed for images. For example with the get_feed_tags() function to look for IMG-tags. Those can be displayed by the widget then.

    Be carefull not to inject content into your site you do not want to inject because of security reasons etc. .

  2. I also was searching for adding thumbnails to my feeds. I found a solution which I’m not sure if it is a best way, but it works. I used RSS Image Widget plugin, and made some changes to the code:

    $desc = $item->get_description();
    if(strlen($desc)>50)
       $desc = wp_html_excerpt($desc, 50).' ... ';
    $blog_title = $item->get_title();
    if(strlen($blog_title)>45)
       $blog_title = wp_html_excerpt($blog_title, 45).' ... ';
    
    echo '<div class="rss_image">
          <a title="'.$item->get_title().'" href="'.$item->get_permalink().'"><img src="'.get_bloginfo('wpurl').'/wp-content/cache/rss_image_cache_'.date('n').'/'.$image_thumb.'" alt="'.$item->get_title().'" /></a>
            <h5><a title="'.$item->get_title().'" href="'.$item->get_permalink().'">'.$blog_title.'</a></h5><p>'.$desc.'</p>
        </div><br />';
    

    Also it’s worth mentioning that on the source blog images were included in the feed.