WP RSS Images – Wordpress Plugin
Wordpress plugin that allows to use the first attached image of your post on your RSS. You can select the size of the images on the admin panel.
Installation
1. Upload ‘wp rss image’ folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the ‘Plugins’ menu in WordPress.
3. Go to Settings/WP RSS Image and select the image size (Thumbnail, Medium, Full) and the feed (rss, rss2).
Settings
Feed Examples
RSS http://web-argument.com/feed/rss/
RSS 2 http://web-argument.com/feed/
Dowload
wp-rss-image v1.00 – From wordpress plugin directory





Hi,
I notice that your plugin only return the first attached picture for a post, but it should be better if it returns the post’s attached thumbnail if exists.
here is the update of your rss_image_url() function :
function rss_image_url($default_size = ‘medium’) {
global $post;
if(has_post_thumbnail()) :
$img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ) );
else:
$attachments = get_children( array(’post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘numberposts’ => 1) );
if($attachments == true) :
foreach($attachments as $id => $attachment) :
$img = wp_get_attachment_image_src($id, $default_size);
endforeach;
endif;
endif;
return $img[0];
}
Best regards, and thanks a lot for your plugin
Does this plugin work with Wordpress 2.7 – 2.9.2 ? Couldn’t get a confirmation on that at http://wordpress.org
This does not work for me. Can you help determine what’s wrong?
Thanks.
-Leshell
Hi, great little plugin. Thanks. I too would like to display the image instead of as an attachment. I think Jacob Cass suggestion to have it grab a custom field would be great. Someone else posted that they needed to easily change the image. Having the option to grab the contents of a custom field would also fix someone else’s request to post the last image instead of the first. What do you think?
The current version does HTTP requests for every found attachment image to get the filesize which makes the loading of feeds *really* slow if you have some of them. This patch fixes that:
Index: wp-rss-images.php-noextrahttprequestsfix.diff
===================================================================
— wp-rss-images.php-noextrahttprequestsfix.diff (revision 0)
+++ wp-rss-images.php-noextrahttprequestsfix.diff (revision 0)
@@ -0,0 +1,37 @@
+— wp-rss-images.php.orig 2010-01-23 19:33:28.000000000 +0100
++++ wp-rss-images.php 2010-01-23 21:22:54.000000000 +0100
+@@ -25,13 +25,11 @@
+ else $image_url = rss_image_url(’medium’);
+
+ if ($image_url != ”) :
+-
+-$filename = $image_url;
+-$ary_header = get_headers($filename, 1);
+-
+-$filesize = $ary_header['Content-Length'];
+-
+-echo “”;
++ $uploads = wp_upload_dir();
++ $url = parse_url($image_url);
++ $path = $uploads['basedir'] . preg_replace(’/.*uploads(.*)/’, ‘${1}’, $url['path']);
++ echo “”;
++ echo “”;
+ endif;
+ }
+
+@@ -39,11 +37,10 @@
+
+ function rss_image_url($default_size = ‘medium’) {
+ global $post;
+- $attachments = get_children( array(’post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘numberposts’ => 1) );
+- if($attachments == true) :
+- foreach($attachments as $id => $attachment) :
+- $img = wp_get_attachment_image_src($id, $default_size);
+- endforeach;
++ $attachments = get_children( array(’post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘menu_item’, ‘numberposts’ => 1) );
++ if($attachments !== false) :
++ $attachement = current($attachments);
++ $img = wp_get_attachment_image_src($attachement->ID, $default_size);
+ endif;
+ return $img[0];
+ }
Works. But seems to limit the images to 5? When I turn it off, I get none. When I turn it on, I get 5.
@Franklin
Ah yes the clear cache should always be checked before any comments. Looks great!
Hi Alain. Thanks for the puggin. I just put up a new 2.8 blog. No errors but no changes to my rss. Any upgrade work arounds or i just need be patient for the update?
Thanks
Franklin
@Aaron
get_header is a wordpress function. Uninstall others plugins to see any interaction.
I am having an issue. When I try to use this plugin, I get the following error when I try to get the RSS feed:
Fatal error: Call to undefined function: get_headers() in /wp-content/plugins/wp-rss-images/wp-rss-images.php on line 30
Is there something I’m doing wrong?
@Stephane
The plugin uses the first attached image you can edit the code to use the last one.
Thanks.
Hi,
Thanks for the plugin! It’s been very useful…
Is there a way we can change the image in the feed once a post has been published? Once in while we have to change the image attached to a post, but th original image stays in the RSS feed…
Thanks,
hi
i want a plugin that import images from skydrive(or any rss refrence) in a post as a album
can you help me that where can i find that?
please
sory for bad english
I’m interested in this WP RSS Images plugin, but I’m not sure that it does exactly what I want it to do.
I aggregate the feed from my Distractions, reflections blog over to Friendfeed. I’ve noticed that a blog entry with photos in it doesn’t produce a photo in Friendfeed (e.g. see this Friendfeed entry picking up a blog post.
I would like the effect described as Using Images to Make Your RSS Feeds Pop, which seems to use an [image] [/image] — read those as angle brackets! — rather than an attachment in the RSS as you do.
I suspect that your plugin might be adapted to do that … but then, I’m not a developer!
Same here. I’m using WP 2.71, and no settings. Should I change sumthin’ in the code?
I couldn’t get it to work either. I’m using WordPress 2.7.1
It activates in wp 2.0.9 but I cannot find the control area. There’s no such thing as Settings/WP RSS Image. There’s an options tab, but nothing about WP RSS Image. Help please.
I could not get it to work on wp 2.7.1 .. after i installed it, it broke my link feed. Does it work on wp 2.7.1
@Gordon Franke
i have add also atom support.
please contact me.
hello i have patched the plugin:
1. add correct Content-Type
2. remove foreach use simple current
3. remove php warning
4. format code
21d20
< $image_size = get_option(’rss_image_size_op’);
23,24c22,23
< if (isset($image_size)) $image_url = rss_image_url($image_size);
$image_size = get_option(’rss_image_size_op’);
> if (isset($image_size)) $image_url = rss_image_url($image_size);
26,28c25,30
< if ($image_url !== false) :
< $filename = $image_url;
else $image_url = rss_image_url(’medium’);
>
> if ($image_url != ”) :
>
> $filename = $image_url;
> $ary_header = get_headers($filename, 1);
30,31c32
< $filesize = $ary_header['Content-Length'];
$filesize = $ary_header['Content-Length'];
33,34c34,35
< echo “”;
echo “”;
> endif;
40,41c41
< global $post;
global $post;
43,48c43,46
<
< if($attachments !== false) :
< $attachment = current($attachments);
ID, $default_size);
<
if($attachments == true) :
> foreach($attachments as $id => $attachment) :
> $img = wp_get_attachment_image_src($id, $default_size);
> endforeach;
50,51c48
<
return $img[0];
Hi, Nice plug in, works great, here it comes, but is there any way to have the image appear in the rss feed ala engadget.com?
Thanks,
Adam
I see that this includes the image as an attachment, but doesn’t actually display the image in the feed. Is this the way the plugin is supposed to work? I want something that will actually show the image along with the text. Please advise.
Thanks for this great plugin. My wifi photo frame needs the Media RSS Module to load images. So I patched your plugin to support it:
http://www.vdberg.org/wp-rss-images.mrss.patch
http://www.vdberg.org/wp-rss-images.txt
Would this display an image that was used in a custom field?
hi. Thanks for plugin
perfect.
Regards
This sure comes in handy. I’ll give it a try and will post results later.
Thanks a lot.