diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 31b349d414..443f0c6d1d 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -349,8 +349,6 @@ function get_attachment_icon_src( $id = 0, $fullsize = false ) { $file = get_attached_file( $post->ID ); - $exts = array('jpg', 'gif', 'png'); - if ( !$fullsize && $thumbfile = wp_get_attachment_thumb_file( $post->ID ) ) { // We have a thumbnail desired, specified and existing diff --git a/wp-includes/post.php b/wp-includes/post.php index 25c1fb367a..c55fb657af 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1471,9 +1471,11 @@ function wp_attachment_is_image( $post_id = 0 ) { if ( !$file = get_attached_file( $post->ID ) ) return false; - $image_exts = array('/jpg', 'jpeg', '/gif', '/png'); + $ext = preg_match('/\.([^.]+)$/', $file, $matches) ? strtolower($matches[1]) : false; - if ( 'image/' == substr($post->post_mime_type, 0, 6) || 'import' == $post->post_mime_type && in_array(substr($file, -4), $exts) ) + $image_exts = array('jpg', 'jpeg', 'gif', 'png'); + + if ( 'image/' == substr($post->post_mime_type, 0, 6) || $ext && 'import' == $post->post_mime_type && in_array($ext, $image_exts) ) return true; return false; }