WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/04/2021 02:43:36 PM (7 months 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/formatting.php

    r49968 r50810  
    33193319    $matches    = array();
    33203320    $ext        = preg_match( '/\.([^.]+)$/', $img, $matches ) ? strtolower( $matches[1] ) : false;
    3321     $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
     3321    $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' );
    33223322
    33233323    // Don't convert smilies that aren't images - they're probably emoji.
Note: See TracChangeset for help on using the changeset viewer.