[wp-trac] [WordPress Trac] #31352: Media icons are not retina friendly

WordPress Trac noreply at wordpress.org
Wed Feb 21 20:21:19 UTC 2024


#31352: Media icons are not retina friendly
--------------------------------------+---------------------------------
 Reporter:  iseulde                   |       Owner:  joedolson
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  6.5
Component:  Media                     |     Version:  3.9
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:  ui, administration
--------------------------------------+---------------------------------
Changes (by sabernhardt):

 * keywords:  has-patch has-unit-tests commit => has-patch has-unit-tests


Comment:

 I'm a little late to comment on the pull request.

 1. Update documentation with `since` note and "Optional":
   - {{{* @since 6.5.0 Added `$preferred_ext` argument.}}}
   - {{{* @param string     $preferred_ext Optional. File format to prefer
 in return. Default .png.}}}
 2. I think some people might miss the period at the beginning of the
 parameter value. I tried adding a conditional statement after the `if ( !
 is_numeric( $mime ) ) {...}` check (using all three conditions and
 ensuring lowercase is probably excessive but it could cover more
 mistakes):
  {{{
 if ( ! empty( $preferred_ext ) && is_string( $preferred_ext ) && !
 str_starts_with( $preferred_ext, '.' ) ) {
         $preferred_ext = '.' . strtolower( $preferred_ext );
 }
  }}}
 3. We probably should add two more unit tests in `post/attachments.php`
 for the new parameter (`test_wp_mime_type_icon_with_preferred_ext()` and
 `test_wp_mime_type_icon_video_with_preferred_ext()`, perhaps in a future
 release/ticket).

 Also, directory searches found `wp_mime_type_icon\(` in
 [https://wpdirectory.net/search/01HQ6A1SZ7HNNJ90NQ0VQCY858 445 plugins]
 and [https://wpdirectory.net/search/01HQ6BRKRSTRW5V99HHX4M660Q 27 themes].

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/31352#comment:54>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list