[wp-trac] [WordPress Trac] #24430: inconsistent icon_dir/icon_dirs use in wp_mime_type_icon and wp_get_attachment_image_src
WordPress Trac
noreply at wordpress.org
Mon May 27 04:33:52 UTC 2013
#24430: inconsistent icon_dir/icon_dirs use in wp_mime_type_icon and
wp_get_attachment_image_src
--------------------------+-----------------------------
Reporter: dglingren | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: 3.5.1
Severity: normal | Keywords:
--------------------------+-----------------------------
/wp-includes/post.php function wp_mime_type_icon allows for multiple icon
image directories by applying the "icon_dirs" filter:
{{{
if ( !is_array($icon_files) ) {
$icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC .
'/images/crystal' );
$icon_dir_uri = apply_filters( 'icon_dir_uri',
includes_url('images/crystal') );
$dirs = apply_filters( 'icon_dirs', array($icon_dir => $icon_dir_uri)
);
$icon_files = array();
while ( $dirs ) {
...
}}}
However, /wp-includes/media.php function wp_get_attachment_image_src does
not apply the "icon_dirs" filter:
{{{
if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
$icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC .
'/images/crystal' );
$src_file = $icon_dir . '/' . wp_basename($src);
@list($width, $height) = getimagesize($src_file);
}
}}}
The base filename is always combined with the default Wordress directory
path and passed to getimagesize. This means that any additional
directories will never be passed to getimagesize(), and an incorrect size
or no size at all will be used for any icon image files not sourced from
the WordPress default directory.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/24430>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list