From 7807a9d116ba968712253130961e3322b37a72f8 Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 10 Mar 2008 21:31:33 +0000 Subject: [PATCH] Icon fixes. See #5911; hat tip: andy. git-svn-id: http://svn.automattic.com/wordpress/trunk@7212 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-attachment-rows.php | 4 ++-- wp-includes/media.php | 17 ++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/wp-admin/edit-attachment-rows.php b/wp-admin/edit-attachment-rows.php index eee71dbd2b..0694380092 100644 --- a/wp-admin/edit-attachment-rows.php +++ b/wp-admin/edit-attachment-rows.php @@ -39,14 +39,14 @@ foreach($posts_columns as $column_name=>$column_display_name) { case 'icon': ?> - ID, false, array(48,48)); ?> + ID, 'thumbnail', array(48,48)); ?> -
+
ID))); ?> ID); ?> diff --git a/wp-includes/media.php b/wp-includes/media.php index be74d0fe0f..8cc799cb42 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -50,6 +50,9 @@ function image_hwstring($width, $height) { // returns an array($url, $width, $height) function image_downsize($id, $size = 'medium') { + if ( !wp_attachment_is_image($id) ) + return false; + $img_url = wp_get_attachment_url($id); $meta = wp_get_attachment_metadata($id); $width = $height = 0; @@ -71,8 +74,6 @@ function image_downsize($id, $size = 'medium') { $width = $info[0]; $height = $info[1]; } - else - return false; } elseif ( isset($meta['width'], $meta['height']) ) { // any other type: use the real image and constrain it @@ -261,16 +262,14 @@ function image_get_intermediate_size($post_id, $size='thumbnail') { function wp_get_attachment_image_src($attachment_id, $size='thumbnail') { // get a thumbnail or intermediate image if there is one - $image = image_downsize($attachment_id, $size); - if ( $image ) { - list ( $src, $width, $height ) = $image; - } - elseif ( $src = wp_mime_type_icon($attachment_id) ) { - $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); + if ( $image = image_downsize($attachment_id, $size) ) + return $image; + + if ( $src = wp_mime_type_icon($attachment_id) ) { + $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' ); $src_file = $icon_dir . '/' . basename($src); @list($width, $height) = getimagesize($src_file); } - if ( $src && $width && $height ) return array( $src, $width, $height ); return false;