[wp-trac] [WordPress Trac] #36418: Custom MIME type icons lost in WP Media List view

WordPress Trac noreply at wordpress.org
Tue Apr 5 01:18:12 UTC 2016


#36418: Custom MIME type icons lost in WP Media List view
--------------------------+-----------------------------
 Reporter:  jhorowitz     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 The ability to define custom MIME icons has been possible since at least
 v2.5, by hooking into several filters, one of which is `icons_dir`.

 `icons_dir` allows you to specify additional directory/uri pairs for the
 `wp_mime_type_icon` routine to search, ideally adding icon support for
 additional MIME types.

 However, going through SVN history, it seems that almost from the
 beginning of the availability of that hook, there has been a loophole
 where the additional icon directories are ignored!

 Specifically:

 `wp_get_attachment_image_src` calls `wp_mime_type_icon`, which in theory
 could select a custom icon directory added by the `icon_dirs` hook. It
 then attempts to fetch width and height information from the selected icon
 file, but only checks the default wp-includes/images/media directory.  Of
 course, this prevents the custom icons from displaying when fetched
 through `wp_get_attachment_image_src`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36418>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list