[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
Fri Dec 20 21:39:57 UTC 2024


#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:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Post Thumbnails  |    Version:  6.7.1
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 Hi, im working on allowing image editor for PDF thumnbails
 https://core.trac.wordpress.org/ticket/62712.

 in functiion stream_preview_image() in wp-admin/includes/image-edit.php -
 line 766
 is function with filter
 {{{#!php
 <?php
 _load_image_to_edit_path( $post_id )
 }}}

 we can change filepath, but for example if we change to
 {{{
 metadata['sizes']['full']
 }}}
 which has mimetype image/jpg, function stream_preview_image() dont send
 image to browser. Bug is in

 {{{#!php
 <?php
 return wp_stream_image( $img, $post->post_mime_type, $post_id );
 }}}
 should be
 {{{#!php
 <?php
 return wp_stream_image( $img, $img['mime-type'], $attachment_id );
 }}}

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


More information about the wp-trac mailing list