Make WordPress Core

Opened 4 hours ago

#62729 new defect (bug)

stream_preview_image() should stream with right mime type, if filter _load_image_to_edit_path change file with different mime type

Reported by: hrohh's profile Hrohh Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.7.1
Component: Post Thumbnails Keywords:
Focuses: Cc:

Description

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
_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
return wp_stream_image( $img, $post->post_mime_type, $post_id );

should be

<?php
return wp_stream_image( $img, $img['mime-type'], $attachment_id );

Change History (0)

Note: See TracTickets for help on using tickets.