Media: Revert WebP generation.

Given [https://make.wordpress.org/core/2022/09/11/webp-in-core-for-6-1/ Matt's recent post about removing WebP from core] and possibly implementing the feature in a future [https://make.wordpress.org/core/2022/09/11/canonical-plugins-revisited/ "Canonical Plugin"], this change reverts changesets [54086], [54094], and [54097].  Additionally, [54210] contained a coding standards follow-up in one of the affected files that is no longer needed.

Reverts [54086], [54094], and [54097].

Props SergeyBiryukov.
See #55443.

git-svn-id: https://develop.svn.wordpress.org/trunk@54226 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
David Baumwald
2022-09-19 22:51:53 +00:00
parent cc3cb33ef5
commit 3b3d7ebb71
17 changed files with 33 additions and 340 deletions

View File

@@ -438,7 +438,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
* @since 3.5.0
*
* @param array $sizes {
* Associative array of image size names and their data.
* An array of image size data arrays.
*
* Either a height or width must be provided.
* If one of the two is set to null, the resize will
@@ -458,9 +458,6 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
$metadata = array();
foreach ( $sizes as $size => $size_data ) {
// Include size name in the data.
$size_data['name'] = $size;
$meta = $this->make_subsize( $size_data );
if ( ! is_wp_error( $meta ) ) {
@@ -475,15 +472,13 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
* Create an image sub-size and return the image meta data value for it.
*
* @since 5.3.0
* @since 6.1.0 The $sizes parameter may now include a $name key for each entry.
*
* @param array $size_data {
* Array of size data.
*
* @type int $width The maximum width in pixels.
* @type int $height The maximum height in pixels.
* @type bool $crop Whether to crop the image to exact dimensions.
* @type string $name Image size name.
* @type int $width The maximum width in pixels.
* @type int $height The maximum height in pixels.
* @type bool $crop Whether to crop the image to exact dimensions.
* }
* @return array|WP_Error The image data array for inclusion in the `sizes` array in the image meta,
* WP_Error object on error.
@@ -493,9 +488,8 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
return new WP_Error( 'image_subsize_create_error', __( 'Cannot resize the image. Both width and height are not set.' ) );
}
$orig_size = $this->size;
$orig_size_name = $this->size_name;
$orig_image = $this->image->getImage();
$orig_size = $this->size;
$orig_image = $this->image->getImage();
if ( ! isset( $size_data['width'] ) ) {
$size_data['width'] = null;
@@ -509,10 +503,6 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
$size_data['crop'] = false;
}
if ( isset( $size_data['name'] ) ) {
$this->update_size_name( $size_data['name'] );
}
$resized = $this->resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
if ( is_wp_error( $resized ) ) {
@@ -525,9 +515,8 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
$this->image = null;
}
$this->size = $orig_size;
$this->size_name = $orig_size_name;
$this->image = $orig_image;
$this->size = $orig_size;
$this->image = $orig_image;
if ( ! is_wp_error( $saved ) ) {
unset( $saved['path'] );