From 716e89b36978adafb89268b89c909d2204b5e2a2 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 2 Jan 2007 19:51:36 +0000 Subject: [PATCH] Now with less bugs. fixes #3411 git-svn-id: http://svn.automattic.com/wordpress/trunk@4671 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post-template.php | 2 -- wp-includes/post.php | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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; }