[wp-trac] [WordPress Trac] #52867: Add capability to set default format for image sub-sizes.

WordPress Trac noreply at wordpress.org
Tue May 4 16:28:15 UTC 2021


#52867: Add capability to set default format for image sub-sizes.
---------------------------------------------------+---------------------
 Reporter:  adamsilverstein                        |       Owner:  (none)
     Type:  enhancement                            |      Status:  new
 Priority:  normal                                 |   Milestone:  5.8
Component:  Media                                  |     Version:
 Severity:  normal                                 |  Resolution:
 Keywords:  has-patch has-unit-tests dev-feedback  |     Focuses:
---------------------------------------------------+---------------------

Comment (by adamsilverstein):

 > Wondering it is would be cleaner to have a filter like this.
 > `return apply_filters( 'image_editor_output_format', array( $filename,
 $new_ext, $mime_type ) );`
 > Just filter return value of get_output_format method. Feels a lot more
 flexible.

 @spacedmonkey This might be a little cleaner or more flexible, however we
 loose some (existing) functionality.
 * If the requested type is not supported by the server, fall back to the
 default mime type.
 * Normalize the $filename to a wp path (although this would still run
 before the filter).

 The current approach also feels a little easier to use from a developer
 perspective. Leaving as is for now!

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


More information about the wp-trac mailing list