Make WordPress Core


Ignore:
Timestamp:
02/02/2024 05:46:50 PM (2 years ago)
Author:
adamsilverstein
Message:

Media: enable AVIF support.

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

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

Props adamsilverstein, lukefiretoss, ayeshrajans, navjotjsingh, Tyrannous, jb510, gregbenz, nickpagz, JavierCasares, mukesh27, yguyon, swissspidy.
Fixes #51228.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/compat.php

    r57337 r57524  
    530530    define( 'IMG_WEBP', IMAGETYPE_WEBP );
    531531}
     532
     533// IMAGETYPE_AVIF constant is only defined in PHP 8.x or later.
     534if ( ! defined( 'IMAGETYPE_AVIF' ) ) {
     535    define( 'IMAGETYPE_AVIF', 19 );
     536}
     537
     538// IMG_AVIF constant is only defined in PHP 8.x or later.
     539if ( ! defined( 'IMG_AVIF' ) ) {
     540    define( 'IMG_AVIF', IMAGETYPE_AVIF );
     541}
Note: See TracChangeset for help on using the changeset viewer.