<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[54226] trunk: Media: Revert WebP generation.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/54226">54226</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/54226","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>davidbaumwald</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-09-19 22:51:53 +0000 (Mon, 19 Sep 2022)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>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 <a href="https://core.trac.wordpress.org/changeset/54086">[54086]</a>, <a href="https://core.trac.wordpress.org/changeset/54094">[54094]</a>, and <a href="https://core.trac.wordpress.org/changeset/54097">[54097]</a>. Additionally, <a href="https://core.trac.wordpress.org/changeset/54210">[54210]</a> contained a coding standards follow-up in one of the affected files that is no longer needed.
Reverts <a href="https://core.trac.wordpress.org/changeset/54086">[54086]</a>, <a href="https://core.trac.wordpress.org/changeset/54094">[54094]</a>, and <a href="https://core.trac.wordpress.org/changeset/54097">[54097]</a>.
Props SergeyBiryukov.
See <a href="https://core.trac.wordpress.org/ticket/55443">#55443</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesimageeditphp">trunk/src/wp-admin/includes/image-edit.php</a></li>
<li><a href="#trunksrcwpadminincludesimagephp">trunk/src/wp-admin/includes/image.php</a></li>
<li><a href="#trunksrcwpincludesclasswpimageeditorgdphp">trunk/src/wp-includes/class-wp-image-editor-gd.php</a></li>
<li><a href="#trunksrcwpincludesclasswpimageeditorimagickphp">trunk/src/wp-includes/class-wp-image-editor-imagick.php</a></li>
<li><a href="#trunksrcwpincludesclasswpimageeditorphp">trunk/src/wp-includes/class-wp-image-editor.php</a></li>
<li><a href="#trunksrcwpincludesdefaultfiltersphp">trunk/src/wp-includes/default-filters.php</a></li>
<li><a href="#trunksrcwpincludesfunctionsphp">trunk/src/wp-includes/functions.php</a></li>
<li><a href="#trunksrcwpincludesmediaphp">trunk/src/wp-includes/media.php</a></li>
<li><a href="#trunktestsphpunittestsimageeditorphp">trunk/tests/phpunit/tests/image/editor.php</a></li>
<li><a href="#trunktestsphpunittestsimageeditorGdphp">trunk/tests/phpunit/tests/image/editorGd.php</a></li>
<li><a href="#trunktestsphpunittestsimageeditorImagickphp">trunk/tests/phpunit/tests/image/editorImagick.php</a></li>
<li><a href="#trunktestsphpunittestsimagefunctionsphp">trunk/tests/phpunit/tests/image/functions.php</a></li>
<li><a href="#trunktestsphpunittestsimageintermediateSizephp">trunk/tests/phpunit/tests/image/intermediateSize.php</a></li>
<li><a href="#trunktestsphpunittestsimageresizephp">trunk/tests/phpunit/tests/image/resize.php</a></li>
<li><a href="#trunktestsphpunittestsmediaphp">trunk/tests/phpunit/tests/media.php</a></li>
<li><a href="#trunktestsphpunittestspostattachmentsphp">trunk/tests/phpunit/tests/post/attachments.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestattachmentscontrollerphp">trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesimageeditphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/image-edit.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/image-edit.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/src/wp-admin/includes/image-edit.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -917,12 +917,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Save the full-size file, also needed to create sub-sizes.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $saved = wp_save_image_file( $new_path, $img, $post->post_mime_type, $post_id );
- if ( ! $saved ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! wp_save_image_file( $new_path, $img, $post->post_mime_type, $post_id ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $return->error = esc_js( __( 'Unable to save the image.' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> return $return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $new_path = $saved['path'];
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'nothumb' === $target || 'all' === $target || 'full' === $target || $scaled ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $tag = false;
</span></span></pre></div>
<a id="trunksrcwpadminincludesimagephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/image.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/image.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/src/wp-admin/includes/image.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -451,9 +451,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( method_exists( $editor, 'make_subsize' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $new_sizes as $new_size_name => $new_size_data ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Include size name in the data.
- $new_size_data['name'] = $new_size_name;
-
</del><span class="cx" style="display: block; padding: 0 10px"> $new_size_meta = $editor->make_subsize( $new_size_data );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_wp_error( $new_size_meta ) ) {
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpimageeditorgdphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-image-editor-gd.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-image-editor-gd.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/src/wp-includes/class-wp-image-editor-gd.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -227,7 +227,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $sizes {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Associative array of image size names and their data.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * An array of image size data arrays.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Either a height or width must be provided.
</span><span class="cx" style="display: block; padding: 0 10px"> * If one of the two is set to null, the resize will
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -247,9 +247,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $metadata = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $sizes as $size => $size_data ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Include size name in the data.
- $size_data['name'] = $size;
-
</del><span class="cx" style="display: block; padding: 0 10px"> $meta = $this->make_subsize( $size_data );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_wp_error( $meta ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -264,15 +261,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Create an image sub-size and return the image meta data value for it.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.3.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 6.1.0 The $sizes parameter may now include a $name key for each entry.
</del><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $size_data {
</span><span class="cx" style="display: block; padding: 0 10px"> * Array of size data.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @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.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @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.
</ins><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array|WP_Error The image data array for inclusion in the `sizes` array in the image meta,
</span><span class="cx" style="display: block; padding: 0 10px"> * WP_Error object on error.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -282,8 +277,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return new WP_Error( 'image_subsize_create_error', __( 'Cannot resize the image. Both width and height are not set.' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $orig_size = $this->size;
- $orig_size_name = $this->size_name;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $orig_size = $this->size;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $size_data['width'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $size_data['width'] = null;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -297,10 +291,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $size_data['crop'] = false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( isset( $size_data['name'] ) ) {
- $this->update_size_name( $size_data['name'] );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> $resized = $this->_resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_wp_error( $resized ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -310,8 +300,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> imagedestroy( $resized );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->size = $orig_size;
- $this->size_name = $orig_size_name;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->size = $orig_size;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_wp_error( $saved ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $saved['path'] );
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpimageeditorimagickphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-image-editor-imagick.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-image-editor-imagick.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/src/wp-includes/class-wp-image-editor-imagick.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -438,7 +438,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $sizes {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Associative array of image size names and their data.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * An array of image size data arrays.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Either a height or width must be provided.
</span><span class="cx" style="display: block; padding: 0 10px"> * If one of the two is set to null, the resize will
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -458,9 +458,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $metadata = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $sizes as $size => $size_data ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Include size name in the data.
- $size_data['name'] = $size;
-
</del><span class="cx" style="display: block; padding: 0 10px"> $meta = $this->make_subsize( $size_data );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_wp_error( $meta ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -475,15 +472,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Create an image sub-size and return the image meta data value for it.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.3.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 6.1.0 The $sizes parameter may now include a $name key for each entry.
</del><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $size_data {
</span><span class="cx" style="display: block; padding: 0 10px"> * Array of size data.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @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.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @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.
</ins><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array|WP_Error The image data array for inclusion in the `sizes` array in the image meta,
</span><span class="cx" style="display: block; padding: 0 10px"> * WP_Error object on error.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -493,9 +488,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return new WP_Error( 'image_subsize_create_error', __( 'Cannot resize the image. Both width and height are not set.' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $orig_size = $this->size;
- $orig_size_name = $this->size_name;
- $orig_image = $this->image->getImage();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $orig_size = $this->size;
+ $orig_image = $this->image->getImage();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $size_data['width'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $size_data['width'] = null;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -509,10 +503,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $size_data['crop'] = false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( isset( $size_data['name'] ) ) {
- $this->update_size_name( $size_data['name'] );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> $resized = $this->resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_wp_error( $resized ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -525,9 +515,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->image = null;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->size = $orig_size;
- $this->size_name = $orig_size_name;
- $this->image = $orig_image;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->size = $orig_size;
+ $this->image = $orig_image;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_wp_error( $saved ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $saved['path'] );
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpimageeditorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-image-editor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-image-editor.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/src/wp-includes/class-wp-image-editor.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -15,7 +15,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> abstract class WP_Image_Editor {
</span><span class="cx" style="display: block; padding: 0 10px"> protected $file = null;
</span><span class="cx" style="display: block; padding: 0 10px"> protected $size = null;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $size_name = '';
</del><span class="cx" style="display: block; padding: 0 10px"> protected $mime_type = null;
</span><span class="cx" style="display: block; padding: 0 10px"> protected $output_mime_type = null;
</span><span class="cx" style="display: block; padding: 0 10px"> protected $default_mime_type = 'image/jpeg';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -119,7 +118,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @abstract
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $sizes {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Associative array of image size names and their data. Default sizes are 'small', 'medium', 'large'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * An array of image size arrays. Default sizes are 'small', 'medium', 'large'.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @type array ...$0 {
</span><span class="cx" style="display: block; padding: 0 10px"> * @type int $width Image width.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -187,7 +186,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return int[] {
</ins><span class="cx" style="display: block; padding: 0 10px"> * Dimensions of the image.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @type int $width The image width.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -203,9 +202,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $width The image width.
- * @param int $height The image height.
- * @return true True on success, false on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $width
+ * @param int $height
+ * @return true
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected function update_size( $width = null, $height = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->size = array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -216,28 +215,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Gets the current image size name.
- *
- * @since 6.1.0
- *
- * @return string Image size name, or empty string if none set.
- */
- public function get_size_name() {
- return $this->size_name;
- }
-
- /**
- * Sets the current image size name.
- *
- * @since 6.1.0
- *
- * @param string $size_name The image size name.
- */
- protected function update_size_name( $size_name ) {
- $this->size_name = (string) $size_name;
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Gets the Image Compression quality on a 1-100% scale.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.0.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -388,7 +365,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @see WP_Image_Editor::get_output_format()
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.8.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 6.1.0 The $size_name parameter was added.
</del><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string[] $output_format {
</span><span class="cx" style="display: block; padding: 0 10px"> * An array of mime type mappings. Maps a source mime type to a new
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -398,9 +374,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $filename Path to the image.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $mime_type The source image mime type.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $size_name The image size name to create, or empty string if not set.
</del><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $output_format = apply_filters( 'image_editor_output_format', array(), $filename, $mime_type, $this->size_name );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $output_format = apply_filters( 'image_editor_output_format', array(), $filename, $mime_type );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $output_format[ $mime_type ] )
</span><span class="cx" style="display: block; padding: 0 10px"> && $this->supports_mime_type( $output_format[ $mime_type ] )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -450,26 +425,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return array( $filename, $new_ext, $mime_type );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Builds an output filename based on current file, and adding proper suffix.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Builds an output filename based on current file, and adding proper suffix
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.5.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 6.1.0 Skips adding a suffix when set to an empty string. When the
- * file extension being generated doesn't match the image file extension,
- * add the extension to the suffix
</del><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $suffix Optional. Suffix to add to the filename. The default null
- * will result in a 'widthxheight' suffix. Passing
- * an empty string will result in no suffix.
- * @param string $dest_path Optional. The path to save the file to. The default null
- * will use the image file path.
- * @param string $extension Optional. The file extension to use. The default null
- * will use the image file extension.
- * @return string filename The generated file name.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $suffix
+ * @param string $dest_path
+ * @param string $extension
+ * @return string filename
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function generate_filename( $suffix = null, $dest_path = null, $extension = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // $suffix will be appended to the destination filename, just before the extension.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( null === $suffix ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $suffix ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $suffix = $this->get_suffix();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -490,21 +458,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( empty( $suffix ) ) {
- $suffix = '';
- } else {
- $suffix = "-{$suffix}";
- }
-
- // When the file extension being generated doesn't match the image file extension,
- // add the extension to the suffix to ensure a unique file name. Prevents
- // name conflicts when a single image type can have multiple extensions,
- // eg. .jpg, .jpeg and .jpe are all valid JPEG extensions.
- if ( ! empty( $extension ) && $extension !== $ext ) {
- $suffix .= "-{$ext}";
- }
-
- return trailingslashit( $dir ) . "{$name}{$suffix}.{$new_ext}";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return trailingslashit( $dir ) . "{$name}-{$suffix}.{$new_ext}";
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcwpincludesdefaultfiltersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/default-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/default-filters.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/src/wp-includes/default-filters.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -636,8 +636,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'media_send_to_editor', 'image_media_send_to_editor', 10, 3 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-add_filter( 'image_editor_output_format', 'wp_default_image_output_mapping', 10, 4 );
-
</del><span class="cx" style="display: block; padding: 0 10px"> // Embeds.
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'rest_api_init', 'wp_oembed_register_route' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4 );
</span></span></pre></div>
<a id="trunksrcwpincludesfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/functions.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/src/wp-includes/functions.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2690,7 +2690,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $is_image ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /** This filter is documented in wp-includes/class-wp-image-editor.php */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $output_formats = apply_filters( 'image_editor_output_format', array(), $_dir . $filename, $mime_type, '' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $output_formats = apply_filters( 'image_editor_output_format', array(), $_dir . $filename, $mime_type );
</ins><span class="cx" style="display: block; padding: 0 10px"> $alt_types = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $output_formats[ $mime_type ] ) ) {
</span></span></pre></div>
<a id="trunksrcwpincludesmediaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/media.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/media.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/src/wp-includes/media.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3927,51 +3927,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Filters the default image output mapping.
- *
- * With this filter callback, WebP image files will be generated for certain JPEG source files.
- *
- * @since 6.1.0
- *
- * @param array $output_mapping Map of mime type to output format.
- * @param string $filename Path to the image.
- * @param string $mime_type The source image mime type.
- * @param string $size_name Optional. The image size name to create, or empty string if not set. Default empty string.
- * @return array The adjusted default output mapping.
- */
-function wp_default_image_output_mapping( $output_mapping, $filename, $mime_type, $size_name = '' ) {
- // If size name is specified, check whether the size supports additional MIME types like WebP.
- if ( $size_name ) {
- // Include only the core sizes that do not rely on add_image_size(). Additional image sizes are opt-in.
- $enabled_sizes = array(
- 'thumbnail' => true,
- 'medium' => true,
- 'medium_large' => true,
- 'large' => true,
- 'post-thumbnail' => true,
- );
-
- /**
- * Filters the sizes that support secondary mime type output. Developers can use this
- * to control the generation of additional mime type sub-sized images.
- *
- * @since 6.1.0
- *
- * @param array $enabled_sizes Map of size names and whether they support secondary mime type output.
- */
- $enabled_sizes = apply_filters( 'wp_image_sizes_with_additional_mime_type_support', $enabled_sizes );
-
- // Bail early if the size does not support additional MIME types.
- if ( empty( $enabled_sizes[ $size_name ] ) ) {
- return $output_mapping;
- }
- }
-
- $output_mapping['image/jpeg'] = 'image/webp';
- return $output_mapping;
-}
-
-/**
</del><span class="cx" style="display: block; padding: 0 10px"> * Prints default Plupload arguments.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.4.0
</span></span></pre></div>
<a id="trunktestsphpunittestsimageeditorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/image/editor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/image/editor.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/tests/phpunit/tests/image/editor.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,7 +18,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> require_once ABSPATH . WPINC . '/class-wp-image-editor.php';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> require_once DIR_TESTDATA . '/../includes/mock-image-editor.php';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_filter( 'image_editor_output_format', '__return_empty_array' );
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // This needs to come after the mock image editor class is loaded.
</span><span class="cx" style="display: block; padding: 0 10px"> parent::set_up();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,14 +24,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Tear down the class.
- */
- public function tear_down() {
- remove_filter( 'image_editor_output_format', '__return_empty_array' );
- parent::tear_down();
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Test wp_get_image_editor() where load returns true
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 6821
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -235,10 +226,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertSame( trailingslashit( realpath( get_temp_dir() ) ), trailingslashit( realpath( dirname( $editor->generate_filename( null, get_temp_dir() ) ) ) ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Test with a suffix only.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertSame( 'canola-100x50-jpg.png', wp_basename( $editor->generate_filename( null, null, 'png' ) ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertSame( 'canola-100x50.png', wp_basename( $editor->generate_filename( null, null, 'png' ) ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Combo!
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertSame( trailingslashit( realpath( get_temp_dir() ) ) . 'canola-new-jpg.png', $editor->generate_filename( 'new', realpath( get_temp_dir() ), 'png' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertSame( trailingslashit( realpath( get_temp_dir() ) ) . 'canola-new.png', $editor->generate_filename( 'new', realpath( get_temp_dir() ), 'png' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Test with a stream destination.
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertSame( 'file://testing/path/canola-100x50.jpg', $editor->generate_filename( null, 'file://testing/path' ) );
</span></span></pre></div>
<a id="trunktestsphpunittestsimageeditorGdphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/image/editorGd.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/image/editorGd.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/tests/phpunit/tests/image/editorGd.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,8 +17,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> require_once ABSPATH . WPINC . '/class-wp-image-editor.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once ABSPATH . WPINC . '/class-wp-image-editor-gd.php';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_filter( 'image_editor_output_format', '__return_empty_array' );
-
</del><span class="cx" style="display: block; padding: 0 10px"> // This needs to come after the mock image editor class is loaded.
</span><span class="cx" style="display: block; padding: 0 10px"> parent::set_up();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -32,8 +30,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->remove_added_uploads();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- remove_filter( 'image_editor_output_format', '__return_empty_array' );
-
</del><span class="cx" style="display: block; padding: 0 10px"> parent::tear_down();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunktestsphpunittestsimageeditorImagickphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/image/editorImagick.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/image/editorImagick.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/tests/phpunit/tests/image/editorImagick.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,8 +18,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once DIR_TESTROOT . '/includes/class-wp-test-stream.php';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_filter( 'image_editor_output_format', '__return_empty_array' );
-
</del><span class="cx" style="display: block; padding: 0 10px"> // This needs to come after the mock image editor class is loaded.
</span><span class="cx" style="display: block; padding: 0 10px"> parent::set_up();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -33,8 +31,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->remove_added_uploads();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- remove_filter( 'image_editor_output_format', '__return_empty_array' );
-
</del><span class="cx" style="display: block; padding: 0 10px"> parent::tear_down();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunktestsphpunittestsimagefunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/image/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/image/functions.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/tests/phpunit/tests/image/functions.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,19 +25,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( glob( $folder ) as $file ) {
</span><span class="cx" style="display: block; padding: 0 10px"> unlink( $file );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- add_filter( 'image_editor_output_format', '__return_empty_array' );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Tear down the class.
- */
- public function tear_down() {
- remove_filter( 'image_editor_output_format', '__return_empty_array' );
- parent::tear_down();
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Gets the available image editor engine classes.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string[] Available image editor classes; empty array when none are available.
</span></span></pre></div>
<a id="trunktestsphpunittestsimageintermediateSizephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/image/intermediateSize.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/image/intermediateSize.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/tests/phpunit/tests/image/intermediateSize.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5,15 +5,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @group upload
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Image_Intermediate_Size extends WP_UnitTestCase {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Set up the test fixture.
- */
- public function set_up() {
- add_filter( 'image_editor_output_format', '__return_empty_array' );
-
- parent::set_up();
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> public function tear_down() {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->remove_added_uploads();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -21,9 +12,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> remove_image_size( 'false-height' );
</span><span class="cx" style="display: block; padding: 0 10px"> remove_image_size( 'false-width' );
</span><span class="cx" style="display: block; padding: 0 10px"> remove_image_size( 'off-by-one' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- remove_filter( 'image_editor_output_format', '__return_empty_array' );
-
</del><span class="cx" style="display: block; padding: 0 10px"> parent::tear_down();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunktestsphpunittestsimageresizephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/image/resize.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/image/resize.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/tests/phpunit/tests/image/resize.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,17 +14,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> parent::set_up();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'wp_image_editors', array( $this, 'wp_image_editors' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_filter( 'image_editor_output_format', '__return_empty_array' );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Tear down the class.
- */
- public function tear_down() {
- remove_filter( 'image_editor_output_format', '__return_empty_array' );
- parent::tear_down();
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> public function wp_image_editors() {
</span><span class="cx" style="display: block; padding: 0 10px"> return array( $this->editor_engine );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunittestsmediaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/media.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/media.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/tests/phpunit/tests/media.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -33,8 +33,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> self::$_sizes = wp_get_additional_image_sizes();
</span><span class="cx" style="display: block; padding: 0 10px"> $GLOBALS['_wp_additional_image_sizes'] = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $filename = DIR_TESTDATA . '/images/' . self::$large_filename;
- add_filter( 'image_editor_output_format', '__return_empty_array' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $filename = DIR_TESTDATA . '/images/' . self::$large_filename;
</ins><span class="cx" style="display: block; padding: 0 10px"> self::$large_id = $factory->attachment->create_upload_object( $filename );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $post_statuses = array( 'publish', 'future', 'draft', 'auto-draft', 'trash' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -69,7 +68,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public static function wpTearDownAfterClass() {
</span><span class="cx" style="display: block; padding: 0 10px"> $GLOBALS['_wp_additional_image_sizes'] = self::$_sizes;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- remove_filter( 'image_editor_output_format', '__return_empty_array' );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public static function tear_down_after_class() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3623,131 +3621,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Clean up the above filter.
</span><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'wp_omit_loading_attr_threshold', '__return_null', 100 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Test the wp_default_image_output_mapping function.
- *
- * @ticket 55443
- */
- public function test_wp_default_image_output_mapping() {
- $mapping = wp_default_image_output_mapping( array(), 'test.jpg', 'image/jpeg', '' );
- $this->assertSame( array( 'image/jpeg' => 'image/webp' ), $mapping );
- }
-
- /**
- * Test that wp_default_image_output_mapping doesn't overwrite existing mappings.
- *
- * @ticket 55443
- */
- public function test_wp_default_image_output_mapping_existing() {
- $mapping = array( 'mime/png' => 'mime/webp' );
- $mapping = wp_default_image_output_mapping( $mapping, 'test.jpg', 'image/jpeg', '' );
- $this->assertSame(
- array(
- 'mime/png' => 'mime/webp',
- 'image/jpeg' => 'image/webp',
- ),
- $mapping
- );
- }
-
- /**
- * Test that the image editor default output for JPEGs is WebP.
- *
- * @ticket 55443
- */
- public function test_wp_image_editor_default_output_maps_to_webp() {
- remove_filter( 'image_editor_output_format', '__return_empty_array' );
-
- $editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
- $this->assertNotWPError( $editor );
-
- $resized = $editor->resize( 100, 100, false );
- $this->assertNotWPError( $resized );
-
- $saved = $editor->save();
- $this->assertNotWPError( $saved );
-
- if ( $editor->supports_mime_type( 'image/webp' ) ) {
- $this->assertSame( 'image/webp', $saved['mime-type'] );
- $this->assertSame( 'canola-100x75-jpg.webp', $saved['file'] );
- } else {
- $this->assertSame( 'image/jpeg', $saved['mime-type'] );
- $this->assertSame( 'canola-100x75.jpg', $saved['file'] );
- }
- }
-
- /**
- * @ticket 56526
- * @dataProvider data_wp_default_image_output_mapping_size_filter
- */
- public function test_wp_default_image_output_mapping_size_filter( $size_name, $filter_callback, $expects_webp ) {
- remove_all_filters( 'wp_image_sizes_with_additional_mime_type_support' );
- if ( $filter_callback ) {
- add_filter( 'wp_image_sizes_with_additional_mime_type_support', $filter_callback );
- }
-
- $mapping = wp_default_image_output_mapping( array(), 'test.jpg', 'image/jpeg', $size_name );
- if ( $expects_webp ) {
- $this->assertSame( array( 'image/jpeg' => 'image/webp' ), $mapping );
- } else {
- $this->assertSame( array(), $mapping );
- }
- }
-
- public function data_wp_default_image_output_mapping_size_filter() {
- return array(
- 'default size thumbnail' => array(
- 'thumbnail',
- null,
- true,
- ),
- 'default size medium' => array(
- 'medium',
- null,
- true,
- ),
- 'default size medium_large' => array(
- 'medium_large',
- null,
- true,
- ),
- 'default size large' => array(
- 'large',
- null,
- true,
- ),
- 'default size unset' => array(
- 'medium',
- function( $enabled_sizes ) {
- unset( $enabled_sizes['medium'] );
- return $enabled_sizes;
- },
- false,
- ),
- 'default size set to false' => array(
- 'medium',
- function( $enabled_sizes ) {
- $enabled_sizes['medium'] = false;
- return $enabled_sizes;
- },
- false,
- ),
- 'custom size' => array(
- 'custom',
- null,
- false,
- ),
- 'custom size opted in' => array(
- 'custom',
- function( $enabled_sizes ) {
- $enabled_sizes['custom'] = true;
- return $enabled_sizes;
- },
- true,
- ),
- );
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunktestsphpunittestspostattachmentsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/post/attachments.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/post/attachments.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/tests/phpunit/tests/post/attachments.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,19 +6,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @group upload
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Post_Attachments extends WP_UnitTestCase {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Set up the test fixture.
- */
- public function set_up() {
- add_filter( 'image_editor_output_format', '__return_empty_array' );
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- parent::set_up();
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> public function tear_down() {
</span><span class="cx" style="display: block; padding: 0 10px"> // Remove all uploads.
</span><span class="cx" style="display: block; padding: 0 10px"> $this->remove_added_uploads();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- remove_filter( 'image_editor_output_format', '__return_empty_array' );
</del><span class="cx" style="display: block; padding: 0 10px"> parent::tear_down();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestattachmentscontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php 2022-09-19 22:35:20 UTC (rev 54225)
+++ trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php 2022-09-19 22:51:53 UTC (rev 54226)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -93,7 +93,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'rest_pre_dispatch', array( $this, 'wpSetUpBeforeRequest' ), 10, 3 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'posts_clauses', array( $this, 'save_posts_clauses' ), 10, 2 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_filter( 'image_editor_output_format', '__return_empty_array' );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function wpSetUpBeforeRequest( $result ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -122,8 +121,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> WP_Image_Editor_Mock::$size_return = null;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- remove_filter( 'image_editor_output_format', '__return_empty_array' );
-
</del><span class="cx" style="display: block; padding: 0 10px"> parent::tear_down();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre>
</div>
</div>
</body>
</html>