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:
parent
0cef1b754e
commit
7807a9d116
|
@ -39,14 +39,14 @@ foreach($posts_columns as $column_name=>$column_display_name) {
|
||||||
|
|
||||||
case 'icon':
|
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
|
<?php
|
||||||
// TODO
|
// TODO
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'media':
|
case 'media':
|
||||||
?>
|
?>
|
||||||
<td><strong><a href="# TODO: upload.php?action=edit&post=<?php the_ID(); ?>"><?php the_title(); ?></a></strong><br />
|
<td><strong><!-- TODO <a href="upload.php?action=edit&post=<?php the_ID(); ?>"> --><?php the_title(); ?><!-- </a> --></strong><br />
|
||||||
<?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
|
<?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
|
||||||
<?php do_action('manage_media_media_column', $post->ID); ?>
|
<?php do_action('manage_media_media_column', $post->ID); ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -50,6 +50,9 @@ function image_hwstring($width, $height) {
|
||||||
// returns an array($url, $width, $height)
|
// returns an array($url, $width, $height)
|
||||||
function image_downsize($id, $size = 'medium') {
|
function image_downsize($id, $size = 'medium') {
|
||||||
|
|
||||||
|
if ( !wp_attachment_is_image($id) )
|
||||||
|
return false;
|
||||||
|
|
||||||
$img_url = wp_get_attachment_url($id);
|
$img_url = wp_get_attachment_url($id);
|
||||||
$meta = wp_get_attachment_metadata($id);
|
$meta = wp_get_attachment_metadata($id);
|
||||||
$width = $height = 0;
|
$width = $height = 0;
|
||||||
|
@ -71,8 +74,6 @@ function image_downsize($id, $size = 'medium') {
|
||||||
$width = $info[0];
|
$width = $info[0];
|
||||||
$height = $info[1];
|
$height = $info[1];
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
elseif ( isset($meta['width'], $meta['height']) ) {
|
elseif ( isset($meta['width'], $meta['height']) ) {
|
||||||
// any other type: use the real image and constrain it
|
// 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') {
|
function wp_get_attachment_image_src($attachment_id, $size='thumbnail') {
|
||||||
|
|
||||||
// get a thumbnail or intermediate image if there is one
|
// get a thumbnail or intermediate image if there is one
|
||||||
$image = image_downsize($attachment_id, $size);
|
if ( $image = image_downsize($attachment_id, $size) )
|
||||||
if ( $image ) {
|
return $image;
|
||||||
list ( $src, $width, $height ) = $image;
|
|
||||||
}
|
if ( $src = wp_mime_type_icon($attachment_id) ) {
|
||||||
elseif ( $src = wp_mime_type_icon($attachment_id) ) {
|
$icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
|
||||||
$icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
|
|
||||||
$src_file = $icon_dir . '/' . basename($src);
|
$src_file = $icon_dir . '/' . basename($src);
|
||||||
@list($width, $height) = getimagesize($src_file);
|
@list($width, $height) = getimagesize($src_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $src && $width && $height )
|
if ( $src && $width && $height )
|
||||||
return array( $src, $width, $height );
|
return array( $src, $width, $height );
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue