Skip to content
Merged
Prev Previous commit
Next Next commit
Add additional information to the webp_uploads_content_image_mimes fi…
…lter.
  • Loading branch information
eugene-manuilov committed Mar 17, 2022
commit d2103c23683286059d3d4ee9bd439b0e4069d001
8 changes: 5 additions & 3 deletions modules/images/webp-uploads/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -560,11 +560,13 @@ function webp_uploads_img_tag_update_mime_type( $image, $context, $attachment_id
*
* @since n.e.x.t
*
* @param array The list of mime types that can be used to update images in the content.
* @param array $target_mimes The list of mime types that can be used to update images in the content.
* @param int $attachment_id The attachment ID.
* @param string $context The current context.
*/
$target_mimes = apply_filters( 'webp_uploads_content_image_mimes', array( 'image/jpeg', 'image/webp' ) );
$target_mimes = apply_filters( 'webp_uploads_content_image_mimes', array( 'image/jpeg', 'image/webp' ), $attachment_id, $context );

$target_mime = null;
$target_mime = null;
// Look for the most progressive image format first.
$target_mimes = array_reverse( $target_mimes );
Comment thread
eugene-manuilov marked this conversation as resolved.
foreach ( $target_mimes as $mime ) {
Comment thread
eugene-manuilov marked this conversation as resolved.
Expand Down