diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index c505c91fb4..0181b1f59c 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -1982,13 +1982,14 @@ function wp_import_handle_upload() { return $file; $url = $file['url']; + $type = $file['type']; $file = addslashes( $file['file'] ); $filename = basename( $file ); // Construct the object array $object = array( 'post_title' => $filename, 'post_content' => $url, - 'post_mime_type' => 'import', + 'post_mime_type' => $type, 'guid' => $url ); diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 36320b554a..5c51359da8 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -351,6 +351,8 @@ function get_attachment_icon($id = 0, $fullsize = false, $max_dims = false) { $file = get_post_meta($post->ID, '_wp_attached_file', true); + $exts = array('jpg', 'gif', 'png'); + if ( !$fullsize && !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) ) { @@ -361,7 +363,7 @@ function get_attachment_icon($id = 0, $fullsize = false, $max_dims = false) { $src_file = $thumbfile; $class = 'attachmentthumb'; - } elseif ( substr($mime, 0, 6) == 'image/' + } elseif ( ( substr($mime, 0, 6) == 'image/' || 'import' == $mime && in_array(substr($file, -3), $exts) ) && file_exists($file) ) { // We have an image without a thumbnail @@ -376,7 +378,6 @@ function get_attachment_icon($id = 0, $fullsize = false, $max_dims = false) { $icon_dir_uri = apply_filters('icon_dir_uri', get_template_directory_uri().'/images'); $types = array(substr($mime, 0, strpos($mime, '/')), substr($mime, strpos($mime, '/') + 1), str_replace('/', '_', $mime)); - $exts = array('jpg', 'gif', 'png'); foreach ($types as $type) { foreach ($exts as $ext) { $src_file = "$icon_dir/$type.$ext";