Index: C:/xampp/htdocs/wordpress_trunk/wp-includes/feed-rss2.php
===================================================================
--- C:/xampp/htdocs/wordpress_trunk/wp-includes/feed-rss2.php	(revision 10843)
+++ C:/xampp/htdocs/wordpress_trunk/wp-includes/feed-rss2.php	(working copy)
@@ -17,6 +17,7 @@
 	xmlns:dc="http://purl.org/dc/elements/1.1/"
 	xmlns:atom="http://www.w3.org/2005/Atom"
 	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
+	xmlns:media="http://search.yahoo.com/mrss/"
 	<?php do_action('rss2_ns'); ?>
 >
 
@@ -54,6 +55,12 @@
 		<wfw:commentRss><?php echo get_post_comments_feed_link(); ?></wfw:commentRss>
 <?php rss_enclosure(); ?>
 	<?php do_action('rss2_item'); ?>
+		
+	<?php 
+		  $media_rss = apply_filters('media_rss', $media_rss = array()); 
+		  media_print_rss( $media_rss ); 
+	?>
+	
 	</item>
 	<?php endwhile; ?>
 </channel>
Index: C:/xampp/htdocs/wordpress_trunk/wp-includes/feed.php
===================================================================
--- C:/xampp/htdocs/wordpress_trunk/wp-includes/feed.php	(revision 10843)
+++ C:/xampp/htdocs/wordpress_trunk/wp-includes/feed.php	(working copy)
@@ -558,3 +558,187 @@
 
 	return $feed;
 }
+
+/** 
+ * search for post content for for img tags, and add them to media_rss array
+ * 
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.8.0
+ */
+function wp_media_rss( $media_rss ){
+	
+	global $mrss_gallery_lookup;
+	
+	// Honor the feed settings. Don't include any media that isn't in the feed.
+	if ( get_option( 'rss_use_excerpt' ) || !strlen( get_the_content() ) ) {
+		$content = the_excerpt_rss();
+	} else {
+		// If any galleries are processed, we need to capture the attachment IDs.
+		add_filter( 'wp_get_attachment_link', 'media_rss_gallery_lookup', 10, 5 );
+		$content = apply_filters( 'the_content', get_the_content() );
+		remove_filter( 'wp_get_attachment_link', 'media_rss_gallery_lookup', 10, 5 );
+		$lookup = $mrss_gallery_lookup;
+		unset( $mrss_gallery_lookup );
+	}
+
+	// img tags
+	$r = preg_match_all('/<img (.+?)>/', $content, $matches ); 
+	
+	if ( $r === false || $r === 0 )
+		return $media_rss; 
+	
+	$num = 0;
+	foreach ( $matches[1] as $attrs ) {
+		$item = $img = array();
+			
+		// Construct $img array from <img> attributes
+		foreach ( wp_kses_hair($attrs, array('http')) as $attr )
+			$img[$attr['name']] = $attr['value'];
+				
+		if ( !isset($img['src']) )
+			continue;
+				
+		$img['src'] = media_rss_url( $img['src'] );
+			
+		// Skip emoticons
+		if ( isset( $img['class'] ) && false !== strpos( $img['class'], 'wp-smiley' ) )
+			continue;
+			
+		if ( false !== strpos( $img['src'], '&' ) ) 
+			continue; 
+			
+		$id = false;
+		if ( isset( $lookup[$img['src']] ) ) {
+			$id = $lookup[$img['src']];
+		} elseif ( isset( $img['class'] ) && preg_match( '/wp-image-(\d+)/', $img['class'], $match ) ) {
+			$id = $match[1];
+		}
+			
+		if ( $id ) {
+			// It's an attachment, so we will get the URLs, title, and description from functions
+			$attachment =& get_post( $id );
+			$src = wp_get_attachment_image_src( $id, 'full' );
+			if ( !empty( $src[0] ) )
+				$img['src'] = $src[0];
+					
+			$thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' );
+			if ( !empty( $thumbnail[0] ) && $thumbnail[0] != $img['src'] )
+				$img['thumbnail'] = $thumbnail[0];
+					
+			$title = get_the_title( $id );
+			if ( !empty( $title ) )
+				$img['title'] = trim($title);
+					
+			$description = get_the_content( $id );
+			if ( !empty( $attachment->post_excerpt ) )
+				$img['description'] = trim($attachment->post_excerpt);
+		}
+			
+		// If this is the first image in the markup, make it the post thumbnail
+		if ( ++$num == 1 ) {
+			if ( isset( $img['thumbnail'] ) )
+				$media_rss[]['thumbnail']['attr']['url'] = $img['thumbnail'];
+			else
+				$media_rss[]['thumbnail']['attr']['url'] = $img['src'];
+		}
+
+		$item['content']['attr']['url'] = $img['src'];
+		$item['content']['attr']['medium'] = 'image';
+		if ( !empty($img['title']) ) {
+			$item['content']['children']['title']['attr']['type'] = 'plain';
+			$item['content']['children']['title']['children'][] = $img['title'];
+		} elseif ( !empty($img['alt']) ) {
+			$item['content']['children']['title']['attr']['type'] = 'plain';
+			$item['content']['children']['title']['children'][] = $img['alt'];
+		}
+		if ( !empty($img['description']) ) {
+			$item['content']['children']['description']['attr']['type'] = 'html';
+			$item['content']['children']['description']['children'][] = $img['description'];
+			}
+		if ( !empty($img['thumbnail']) )
+			$item['content']['children']['thumbnail']['attr']['url'] = $img['thumbnail'];
+		
+		$media_rss[] = $item;
+	}
+	
+	return $media_rss; 
+}
+add_filter( 'media_rss', 'wp_media_rss' ); 
+
+function media_rss_url( $url ) {
+	
+	if ( preg_match( '!^https?://!', $url ) )
+		return $url;
+	if ( $url{0} == '/' )
+		return rtrim( get_bloginfo('home'), '/' ) . $url;
+		
+	return get_bloginfo('home') . $url;
+}
+
+function media_rss_gallery_lookup( $link, $id, $size, $permalink, $icon ) {
+	global $media_rss_gallery_lookup;
+	
+	preg_match( '/ src="(.*?)"/', $link, $matches );
+	$media_rss_gallery_lookup[$matches[1]] = $id;
+	
+	return $link;
+}
+
+/**
+ * print media_rss array to generate mrss entries such as <media:content> 
+ * 
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.8.0
+ */
+function media_print_rss( $media_rss ) {
+
+	foreach( (array)$media_rss as $elements )
+		media_print_element( $elements );
+		
+	echo "\n";
+}
+
+function media_print_element( $elements, $indent = 2 ) {
+	
+	echo "\n"; 
+	foreach ( (array)$elements as $name => $data ) {
+		
+		echo str_repeat("\t", $indent) . "<media:$name";
+		if ( !empty($data['attr']) ) {
+			foreach ( $data['attr'] as $attr => $value )
+				echo " $attr=\"" . ent2ncr($value) . "\"";
+		}
+		if ( !empty($data['children']) ) {
+			$nl = false;
+			echo ">"; 
+			foreach ( $data['children'] as $_name => $_data ) {
+				
+				if ( is_int($_name) ) {
+					
+					if ( !is_array( $_data ) ){
+						echo ent2ncr($_data);
+					}else {
+						//allow nested same level elements
+						$nl = true;
+						media_print_element( $_data, $indent + 1 );
+					}
+					
+				} else {
+					$nl = true;
+					media_print_element( array( $_name => $_data ), $indent + 1 );
+				}
+			}
+			
+			if ( $nl )
+				echo str_repeat("\t", $indent);
+				
+			echo "</media:$name>\n";
+		} else {
+			echo " />\n";
+		}
+	}
+}
+
+?>
