WordPress.org

Make WordPress Core

Opened 11 months ago

Last modified 6 weeks ago

#47713 reviewing defect (bug)

image_get_intermediate_size does not return size if it equals original size

Reported by: mahnunchik Owned by: SergeyBiryukov
Milestone: Future Release Priority: normal
Severity: major Version: 5.2.2
Component: Media Keywords: has-patch needs-unit-tests
Focuses: Cc:

Description

Function image_get_intermediate_size does not return size if it equal original size.

  1. WordPress itself doesn't generate sizes metadata item for size equal original image size.
  2. image_get_intermediate_size looks throught sizes metadata and doesn't see necessary size.
  3. It doesn't check original image size.

More details here: https://github.com/Yoast/wordpress-seo/issues/10863

Attachments (2)

47713.diff (1.2 KB) - added by mahnunchik 11 months ago.
Select full size image if it is exact match to intermediate image fixes #47713 and #21714
47713.2.diff (1.4 KB) - added by mahnunchik 10 months ago.
correct patch

Download all attachments as: .zip

Change History (11)

@mahnunchik
11 months ago

Select full size image if it is exact match to intermediate image fixes #47713 and #21714

#2 @mahnunchik
11 months ago

I've fixed it! And another 7 years old ticket #21714

Last edited 5 months ago by SergeyBiryukov (previous) (diff)

#3 @mahnunchik
10 months ago

The correct version of patch attached.

@mahnunchik
10 months ago

correct patch

#4 follow-up: @mahnunchik
7 weeks ago

Any news?

#5 @markparnell
6 weeks ago

  • Keywords has-patch added; needs-patch removed

#6 in reply to: ↑ 4 @SergeyBiryukov
6 weeks ago

  • Keywords needs-unit-tests added
  • Milestone changed from Awaiting Review to Future Release

Replying to mahnunchik:

Any news?

Thanks for the patch, sorry it took so long for someone to get back to you.

Just a quick note that I've started reviewing the patch a while ago, but didn't get a chance to finish the review yet. I'll try to follow up in near future.

Some unit tests would be helpful here.

#7 follow-up: @SergeyBiryukov
6 weeks ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#8 in reply to: ↑ 7 ; follow-up: @mahnunchik
6 weeks ago

Replying to SergeyBiryukov:

Hi, I'm happy to hear it.

Could you give me some useful links for documentation about testing such features. Links to examples of tests will be useful too.

#9 in reply to: ↑ 8 @skorasaurus
6 weeks ago

Replying to mahnunchik:

Replying to SergeyBiryukov:

Hi, I'm happy to hear it.

Could you give me some useful links for documentation about testing such features. Links to examples of tests will be useful too.

https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/
https://carlalexander.ca/introduction-wordpress-unit-testing/

I hope that helps :)

Note: See TracTickets for help on using tickets.