From b7489425cb8a6504d094e4d91d91ffca03e9a8f5 Mon Sep 17 00:00:00 2001 From: desrosj Date: Mon, 14 Jun 2021 18:59:59 +0000 Subject: [PATCH] Site Health: Display a list of file formats supported by the GD library. This adds the list of file formats supported by the GD library to the Media Handling section in Site Health. This will help site owners debug any issues they encounter as support for newer, more modern image formats is added (such as WebP in [50810]). Follow up to [50817]. Props adamsilverstein, jorbin. Fixes #53022. Built from https://develop.svn.wordpress.org/trunk@51143 git-svn-id: http://core.svn.wordpress.org/trunk@50752 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-debug-data.php | 27 +++++++++++++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/class-wp-debug-data.php b/wp-admin/includes/class-wp-debug-data.php index 85ef2384c9..016c9e3129 100644 --- a/wp-admin/includes/class-wp-debug-data.php +++ b/wp-admin/includes/class-wp-debug-data.php @@ -631,6 +631,33 @@ class WP_Debug_Data { 'debug' => ( is_array( $gd ) ? $gd['GD Version'] : 'not available' ), ); + $gd_image_formats = array(); + $gd_supported_formats = array( + 'GIF Create' => 'GIF', + 'JPEG' => 'JPEG', + 'PNG' => 'PNG', + 'WebP' => 'WebP', + 'BMP' => 'BMP', + 'AVIF' => 'AVIF', + 'HEIF' => 'HEIF', + 'TIFF' => 'TIFF', + 'XPM' => 'XPM', + ); + + foreach ( $gd_supported_formats as $format_key => $format ) { + $index = $format_key . ' Support'; + if ( isset( $gd[ $index ] ) && $gd[ $index ] ) { + array_push( $gd_image_formats, $format ); + } + } + + if ( ! empty( $gd_image_formats ) ) { + $info['wp-media']['fields']['gd_formats'] = array( + 'label' => __( 'GD supported file formats' ), + 'value' => implode( ', ', $gd_image_formats ), + ); + } + // Get Ghostscript information, if available. if ( function_exists( 'exec' ) ) { $gs = exec( 'gs --version' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index ba5574f2f9..4165cb5836 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8-beta1-51142'; +$wp_version = '5.8-beta1-51143'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.