[wp-trac] [WordPress Trac] #62729: stream_preview_image() should stream with right mime type, if filter _load_image_to_edit_path change file with different mime type

WordPress Trac noreply at wordpress.org
Mon Mar 17 09:36:22 UTC 2025


#62729: stream_preview_image() should stream with right mime type, if filter
_load_image_to_edit_path change file with different mime type
--------------------------------------+------------------------------
 Reporter:  Hrohh                     |       Owner:  pbearne
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Post Thumbnails           |     Version:  6.7.1
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------------

Comment (by Hrohh):

 @pbearne Hi Paul, like this

 {{{#!php
 <?php
 add_filter( 'load_image_to_edit_path', 'avif_load_image_to_edit_path', 10,
 3 );
 function avif_load_image_to_edit_path( $filepath, $attachment_id, $size )
 {
     return str_replace( '.jpg', '.avif', $filepath );
 }
 }}}


 wp_stream_image function will send image/jpeg instead image/avif.

 Thank you.

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


More information about the wp-trac mailing list