Now with less bugs. fixes #3411

git-svn-id: http://svn.automattic.com/wordpress/trunk@4671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-01-02 19:51:36 +00:00
parent cd99ca7b90
commit 716e89b369
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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;
}