[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
Thu Jun 11 05:29:49 UTC 2015
#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: Media | Version: 2.5
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------------------
Changes (by dglingren):
* keywords: has-patch reporter-feedback => has-patch
Comment:
Thank you for looking into this issue. To reproduce the problem:
1. Create a directory and put an icon in it, e.g.,
/wp-content/plugins/media-library-assistant/images/crystal/pdf.png'
2. Hook the 'ext2type' filter and add an association from a file type to
the icon, e.g.,
array( 'pdf' => array ( 0 => 'pdf', )
3. Hook the 'icon_dirs' filter and add the directory and url to the array,
e.g.,
function mla_icon_dirs_filter( $path_uri_array ) {
$path_uri_array [ MLA_PLUGIN_PATH . 'images/crystal' ] = MLA_PLUGIN_URL .
'images/crystal';
return $path_uri_array;
}
wp_mime_type_icon() will find pdf.png in the added directory, but
wp_get_attachment_image_src() will discard the path and look for the file
in the WordPress default directory; " $src_file = $icon_dir . '/' .
wp_basename($src); ".
I regret that the initial description was unclear, and if you need
anything else I am happy to expand on the above.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/24430#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list