Icon fixes. See #5911; hat tip: andy.

git-svn-id: http://svn.automattic.com/wordpress/trunk@7212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2008-03-10 21:31:33 +00:00
parent 0cef1b754e
commit 7807a9d116
2 changed files with 10 additions and 11 deletions

View File

@ -39,14 +39,14 @@ foreach($posts_columns as $column_name=>$column_display_name) {
case 'icon':
?>
<td class="media-icon"><?php echo the_attachment_link($post->ID, false, array(48,48)); ?></td>
<td class="media-icon"><?php echo get_the_attachment_link($post->ID, 'thumbnail', array(48,48)); ?></td>
<?php
// TODO
break;
case 'media':
?>
<td><strong><a href="# TODO: upload.php?action=edit&amp;post=<?php the_ID(); ?>"><?php the_title(); ?></a></strong><br />
<td><strong><!-- TODO <a href="upload.php?action=edit&amp;post=<?php the_ID(); ?>"> --><?php the_title(); ?><!-- </a> --></strong><br />
<?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
<?php do_action('manage_media_media_column', $post->ID); ?>
</td>

View File

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