Make WordPress Core


Ignore:
Timestamp:
05/04/2021 02:43:36 PM (5 years ago)
Author:
adamsilverstein
Message:

Images: enable WebP support.

Add support for uploading, editing and saving WebP images when supported by the server.

Add 'image/webp' to supported mime types. Correctly identify WebP images and sizes even when PHP doesn't support WebP. Resize uploaded WebP files (when supported) and use for front end markup.

Props markoheijne, blobfolio, Clorith, joemcgill, atjn, desrosj, spacedmonkey, marylauc, mikeschroder, hellofromtonya, flixos90.
Fixes #35725.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

    r50152 r50810  
    439439                }
    440440
    441                 $supported_types = array( 'image/jpeg', 'image/png', 'image/gif' );
     441                $supported_types = array( 'image/jpeg', 'image/png', 'image/gif', 'image/webp' );
    442442                $mime_type       = get_post_mime_type( $attachment_id );
    443443                if ( ! in_array( $mime_type, $supported_types, true ) ) {
Note: See TracChangeset for help on using the changeset viewer.