Don't use 'import' as a mime type. Props mdawaffe and westi. fixes #3219
git-svn-id: http://svn.automattic.com/wordpress/trunk@4552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f068409a63
commit
556b27b296
|
@ -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
|
||||
);
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in New Issue