Index: wp-includes/media.php
===================================================================
--- wp-includes/media.php	(revision 14085)
+++ wp-includes/media.php	(working copy)
@@ -137,6 +137,7 @@
 	$meta = wp_get_attachment_metadata($id);
 	$width = $height = 0;
 	$is_intermediate = false;
+	$img_url_basename = substr(basename(str_replace('\\','\\a',str_replace('/','/a',$img_url))),1);
 
 	// plugins can use this to provide resize services
 	if ( $out = apply_filters('image_downsize', false, $id, $size) )
@@ -144,7 +145,7 @@
 
 	// try for a new style intermediate size
 	if ( $intermediate = image_get_intermediate_size($id, $size) ) {
-		$img_url = str_replace(basename($img_url), $intermediate['file'], $img_url);
+		$img_url = str_replace($img_url_basename, $intermediate['file'], $img_url);
 		$width = $intermediate['width'];
 		$height = $intermediate['height'];
 		$is_intermediate = true;
@@ -152,7 +153,8 @@
 	elseif ( $size == 'thumbnail' ) {
 		// fall back to the old thumbnail
 		if ( ($thumb_file = wp_get_attachment_thumb_file($id)) && $info = getimagesize($thumb_file) ) {
-			$img_url = str_replace(basename($img_url), basename($thumb_file), $img_url);
+			$thumb_file_basename = substr(basename(str_replace('\\','\\a',str_replace('/','/a',$thumb_file))),1);
+			$img_url = str_replace($img_url_basename, $thumb_file_basename, $img_url);
 			$width = $info[0];
 			$height = $info[1];
 			$is_intermediate = true;
@@ -412,7 +414,7 @@
 	$info = pathinfo($file);
 	$dir = $info['dirname'];
 	$ext = $info['extension'];
-	$name = basename($file, ".{$ext}");
+	$name = substr(basename(str_replace('\\','\\a',str_replace('/','/a',$file)), ".{$ext}"),1);
 	if ( !is_null($dest_path) and $_dest_path = realpath($dest_path) )
 		$dir = $_dest_path;
 	$destfilename = "{$dir}/{$name}-{$suffix}.{$ext}";
@@ -461,7 +463,7 @@
 		if ( !is_wp_error($resized_file) && $resized_file && $info = getimagesize($resized_file) ) {
 			$resized_file = apply_filters('image_make_intermediate_size', $resized_file);
 			return array(
-				'file' => basename( $resized_file ),
+				'file' => substr(basename(str_replace('\\','\\a',str_replace('/','/a',$resized_file))),1),
 				'width' => $info[0],
 				'height' => $info[1],
 			);
