Index: wordpress/wp-includes/post-template.php
===================================================================
--- wordpress/wp-includes/post-template.php	(revision 7148)
+++ wordpress/wp-includes/post-template.php	(working copy)
@@ -362,10 +362,34 @@
 // Attachments
 //
 
-function the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
-	echo get_the_attachment_link($id, $fullsize, $max_dims, $permalink);
+function the_attachment_link($id = 0, $fullsize = false, $deprecated = false, $permalink = false) {
+	if ( $fullsize )
+		echo wp_get_attachment_link($id, 'full', $permalink);
+	else
+		echo wp_get_attachment_link($id, 'thumbnail', $permalink);
 }
 
+// get an attachment page link using an image or icon if possible
+function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false) {
+	$_post = & get_post( intval($id) );
+
+	if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
+		return __('Missing Attachment');
+
+	if ( $permalink )
+		$url = get_attachment_link($_post->ID);
+
+	$post_title = attribute_escape($_post->post_title);
+
+	$link_text = wp_get_attachment_image($attachment_id, $size);
+	if ( !$link_text )
+		$link_text = $_post->post_title;
+
+	return "<a href='$url' title='$post_title'>$link_text</a>";
+
+}
+
+// deprecated - use wp_get_attachment_link()
 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
 	$id = (int) $id;
 	$_post = & get_post($id);
@@ -382,6 +406,8 @@
 	return "<a href='$url' title='$post_title'>$innerHTML</a>";
 }
 
+
+// deprecated: use wp_get_attachment_image_src()
 function get_attachment_icon_src( $id = 0, $fullsize = false ) {
 	$id = (int) $id;
 	if ( !$post = & get_post($id) )
@@ -413,11 +439,12 @@
 	return array($src, $src_file);
 }
 
+// deprecated: use wp_get_attachment_image()
 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
 	$id = (int) $id;
 	if ( !$post = & get_post($id) )
 		return false;
-
+		
 	if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
 		return false;
 
@@ -456,6 +483,7 @@
 	return apply_filters( 'attachment_icon', $icon, $post->ID );
 }
 
+// deprecated: use wp_get_attachment_image()
 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
 	$id = (int) $id;
 	if ( !$post = & get_post($id) )
@@ -472,7 +500,8 @@
 
 function prepend_attachment($content) {
 	$p = '<p class="attachment">';
-	$p .= get_the_attachment_link(false, true, array(400, 300));
+	// show the medium sized image representation of the attachment if available, and link to the raw file
+	$p .= wp_get_attachment_link(0, 'medium', false);
 	$p .= '</p>';
 	$p = apply_filters('prepend_attachment', $p);
 
Index: wordpress/wp-includes/media.php
===================================================================
--- wordpress/wp-includes/media.php	(revision 7148)
+++ wordpress/wp-includes/media.php	(working copy)
@@ -18,18 +18,16 @@
 		$max_width = intval(get_option('medium_size_w'));
 		$max_height = intval(get_option('medium_size_h'));
 		// if no width is set, default to the theme content width if available
-		if ( !$max_width ) {
-			// $content_width might be set in the current theme's functions.php
-			if ( !empty($GLOBALS['content_width']) ) {
-				$max_width = $GLOBALS['content_width'];
-			}
-			else
-				$max_width = 500;
-		}
 	}
 	else { // $size == 'full'
-		$max_width = 0;
-		$max_height = 0;
+		// we're inserting a full size image into the editor.  if it's a really big image we'll scale it down to fit reasonably
+		// within the editor itself, and within the theme's content width if it's known.  the user can resize it in the editor
+		// if they wish.
+		if ( !empty($GLOBALS['content_width']) ) {
+			$max_width = $GLOBALS['content_width'];
+		}
+		else
+			$max_width = 500;
 	}
 
 	list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size );
@@ -258,5 +256,38 @@
 	return $imagedata['sizes'][$size];
 }
 
+// get an image to represent an attachment - a mime icon for files, thumbnail or intermediate size for images
+// returns an array (url, width, height), or false if no image is available
+function wp_get_attachment_image_src($attachment_id, $size='thumbnail') {
+	
+	// get a thumbnail or intermediate image if there is one
+	$image = image_downsize($attachment_id, $size);
+	if ( $image ) {
+		list ( $src, $width, $height ) = $image;
+	}
+	elseif ( $src = wp_mime_type_icon($attachment_id) ) {
+		$icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
+		$src_file = $icon_dir . '/' . basename($src);
+		@list($width, $height) = getimagesize($src_file);
+	}
+	
+	if ( $src && $width && $height )
+		return array( $src, $width, $height );
+	return false;
+}
 
+// as per wp_get_attachment_image_src, but returns an <img> tag
+function wp_get_attachment_image($attachment_id, $size='thumbnail') {
+
+	$html = '';
+	$image = wp_get_attachment_image_src($attachment_id, $size);
+	if ( $image ) {
+		list($src, $width, $height) = $image;
+		$hwstring = image_hwstring($width, $height);
+		$html = '<img src="'.attribute_escape($src).'" '.$hwstring.'class="attachment-'.attribute_escape($size).'" />';
+	}
+	
+	return $html;
+}
+
 ?>
Index: wordpress/wp-admin/includes/schema.php
===================================================================
--- wordpress/wp-admin/includes/schema.php	(revision 7148)
+++ wordpress/wp-admin/includes/schema.php	(working copy)
@@ -247,8 +247,8 @@
 	add_option('thumbnail_size_w', 150);
 	add_option('thumbnail_size_h', 150);
 	add_option('thumbnail_crop', 1);
-	add_option('medium_size_w', '');
-	add_option('medium_size_h', '');
+	add_option('medium_size_w', 300);
+	add_option('medium_size_h', 300);
 	add_option('autosave_interval', 60);
 
 	// Delete unused options

