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:
parent
cd99ca7b90
commit
716e89b369
|
@ -349,8 +349,6 @@ function get_attachment_icon_src( $id = 0, $fullsize = false ) {
|
||||||
|
|
||||||
$file = get_attached_file( $post->ID );
|
$file = get_attached_file( $post->ID );
|
||||||
|
|
||||||
$exts = array('jpg', 'gif', 'png');
|
|
||||||
|
|
||||||
if ( !$fullsize && $thumbfile = wp_get_attachment_thumb_file( $post->ID ) ) {
|
if ( !$fullsize && $thumbfile = wp_get_attachment_thumb_file( $post->ID ) ) {
|
||||||
// We have a thumbnail desired, specified and existing
|
// We have a thumbnail desired, specified and existing
|
||||||
|
|
||||||
|
|
|
@ -1471,9 +1471,11 @@ function wp_attachment_is_image( $post_id = 0 ) {
|
||||||
if ( !$file = get_attached_file( $post->ID ) )
|
if ( !$file = get_attached_file( $post->ID ) )
|
||||||
return false;
|
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 true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue