Automattic / vip-go-mu-plugins

The development repo for mu-plugins used on the WordPress VIP Platform.
https://docs.wpvip.com/
GNU General Public License v2.0
188 stars 103 forks source link

Add medium_large size to the image_downsize filter #5798

Closed anigeluk closed 1 month ago

anigeluk commented 1 month ago

Description

We currently filter image_downsize using most of the default reserved image sizes but still need to include medium_large. This means that anyone using medium_large as an image size gets the wrong height and width returned.

Changelog Description

Fixed

Pre-review checklist

Please make sure the items below have been covered before requesting a review:

Pre-deploy checklist

Steps to Test

-Checkout the changed a8c-files.php and retest the image size and you should get the correct default width for medium_large of 768px

wp_get_attachment_image(23,'medium_large','')
=> phar:///usr/local/bin/wp/vendor/wp-cli/shell-command/src/WP_CLI/Shell/REPL.php:52:
string(1023) "<img width="768" height="1152" src="http://anigel-testsite.go-vip.net/wp-content/uploads/2024/08/Wiki_Test_Image.jpg?w=768" class="attachment-medium_large size-medium_large" alt="" decoding="async" loading="lazy" srcset="http://anigel-testsite.go-vip.net/wp-content/uploads/2024/08/Wiki_Test_Image.jpg 1728w, http://anigel-testsite.go-vip.net/wp-content/uploads/2024/08/Wiki_Test_Image.jpg?resize=200,300 200w, http://anigel-testsite.go-vip.net/wp-content/uploads/2024/08/Wiki_Test_Image.jpg?resize=768,1152 768w, http://anigel-testsite.go-vip.net/wp-content/uploads/2024/08/Wiki_Test_Image.jpg?resize=683,1024 683w, http://anigel-testsite.go-vip.net/wp-content/uploads/2024/08/Wiki_Test_Image.jpg?resize=1024,1536 1024w, http://anigel-testsite.go-vip.net/wp-content/uploads/2024/08/Wiki_Test_Image.jpg?resize=1365,2048 1365w, http://anigel-testsite.go-vip.net/wp-content/uploads/2024/08/Wiki_Test_Image.jpg?resize=1568,2352 1568w" sizes="(max-width: 768px) 100vw, 768px" style="width:100%;height:150%;max-width:1728px;" />"
sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 29.54%. Comparing base (0f095a7) to head (8fd55f9). Report is 35 commits behind head on develop.

Files Patch % Lines
a8c-files.php 0.00% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #5798 +/- ## ============================================= + Coverage 29.53% 29.54% +0.01% - Complexity 4779 4780 +1 ============================================= Files 282 282 Lines 20597 20588 -9 ============================================= Hits 6083 6083 + Misses 14514 14505 -9 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.