Index: wp-includes/media.php
===================================================================
--- wp-includes/media.php	(revision 21175)
+++ wp-includes/media.php	(working copy)
@@ -395,7 +395,7 @@
 /**
  * Scale down an image to fit a particular size and save a new copy of the image.
  *
- * The PNG transparency will be preserved using the function, as well as the
+ * The PNG and GIF transparency will be preserved using the function, as well as the
  * image type. If the file going in is PNG, then the resized image is going to
  * be PNG. The only supported image types are PNG, GIF, and JPEG.
  *
@@ -430,7 +430,7 @@
 		return new WP_Error( 'error_getting_dimensions', __('Could not calculate resized image dimensions') );
 	list($dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) = $dims;
 
-	$newimage = wp_imagecreatetruecolor( $dst_w, $dst_h );
+	$newimage = wp_imagecreatetruecolor( $dst_w, $dst_h, $orig_type, $image );
 
 	imagecopyresampled( $newimage, $image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
 
@@ -1019,14 +1019,28 @@
  *
  * @param int $width Image width
  * @param int $height Image height
+ * @param int $image_type Image type
+ * @param resource $original_image Original image
  * @return image resource
  */
-function wp_imagecreatetruecolor($width, $height) {
-	$img = imagecreatetruecolor($width, $height);
-	if ( is_resource($img) && function_exists('imagealphablending') && function_exists('imagesavealpha') ) {
-		imagealphablending($img, false);
-		imagesavealpha($img, true);
+function wp_imagecreatetruecolor( $width, $height, $image_type = null, $original_image = null ) {
+	$img = imagecreatetruecolor( $width, $height );
+	if ( ! is_resource( $img ) )
+		return false;
+
+	if ( IMAGETYPE_GIF == $image_type && is_resource( $original_image ) && function_exists( 'imagecolortransparent' ) ) { 
+		$transparent_id = imagecolortransparent( $original_image );
+		if ( $transparent_id >= 0 ) {
+			$transparent_color = imagecolorsforindex( $original_image, $transparent_id );
+			$transparent_id = imagecolorallocate( $img, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue'] );
+			imagefill( $img, 0, 0, $transparent_id );
+			imagecolortransparent( $img, $transparent_id );
+		}
+	} elseif ( function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' ) ) {
+		imagealphablending( $img, false );
+		imagesavealpha( $img, true );
 	}
+
 	return $img;
 }
 
