Index: wp-admin/press-this.php
===================================================================
--- wp-admin/press-this.php	(revision 8171)
+++ wp-admin/press-this.php	(working copy)
@@ -4,15 +4,19 @@
 if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin&#8217; uh?' )); ?>
 
 <?php 
+
+function preg_quote2($string) {
+	return str_replace('/', '\/', preg_quote($string));
+}
 function press_it() {
-	#define some basic variables
+	// define some basic variables
 	$quick['post_status'] = $_REQUEST['post_status'];
 	$quick['post_category'] = $_REQUEST['post_category'];
 	$quick['tags_input'] = $_REQUEST['tags_input'];
 	$quick['post_title'] = $_REQUEST['post_title'];
 	$quick['post_content'] = '';
 		
-	# insert the post with nothing in it, to get an ID
+	// insert the post with nothing in it, to get an ID
 	$post_ID = wp_insert_post($quick, true);
 		
 	$content = '';
@@ -23,16 +27,21 @@
 			break;
 		
 		case 'photo':
-			foreach($_REQUEST['photo_src'] as $key => $data) {
+			$content = $_REQUEST['content'];
+			
+			foreach($_REQUEST['photo_src'] as $key => $image) {
 				#quote for matching
-				$quoted = str_replace('/', '\/', preg_quote($data));
+				$quoted = preg_quote2($image);
 				
-				# see if files exist in content - we don't want to upload non-used selected files.
+				// see if files exist in content - we don't want to upload non-used selected files.
 				preg_match('/'.$quoted.'/', $_REQUEST['content'], $matches[0]);
-				if($matches[0])
-					$upload = media_sideload_image($data, $post_ID, $_REQUEST['photo_description'][$key]);	
+				if($matches[0]) {
+					$upload = media_sideload_image($image, $post_ID, $_REQUEST['photo_description'][$key]);
+					// Replace the POSTED content <img> with correct uploaded ones.
+					if( !is_wp_error($upload) ) $content = preg_replace('/<img ([^>]*)src=(\"|\')'.$quoted.'(\2)([^>\/]*)\/*>/is', $upload, $content);
+				}
 			}
-			$content = $_REQUEST['content'];
+			
 			break;
 			
 		case "video":
Index: wp-admin/includes/media.php
===================================================================
--- wp-admin/includes/media.php	(revision 8171)
+++ wp-admin/includes/media.php	(working copy)
@@ -151,11 +151,9 @@
 	$id = wp_insert_attachment($attachment, $file, $post_parent);
 	if ( !is_wp_error($id) ) {
 		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
-		return $src;
+		return $url;
 	}
-	
 	return $id;
-
 }
 
 
@@ -321,21 +319,20 @@
 		$desc = @$desc;
 		
 		$id = media_handle_sideload($file_array, $post_id, $desc);
+		$src = $id;
+
 		unset($file_array);
-		
+
 		if ( is_wp_error($id) ) {
 			$errors['upload_error'] = $id;
 			return $id;
-		} else {
-			$src = $id;
 		}
 	}
-	
-	if (!empty($src) && !strpos($src, '://') ) {
-		$src = "http://$src";
-		$alt = @$desc;
-	}
+
 	if ( !empty($src) ) {
+		if ( !strpos($src, '://') )
+			$src = "http://$src";
+		$alt = @$desc;
 		$html = "<img src='$src' alt='$alt' />";
 		return $html;
 	}
