Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#50722 closed enhancement (fixed)

Change params on wp_image_file_matches_image_meta function

Reported by: spacedmonkey's profile spacedmonkey Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.5
Component: Media Keywords: has-patch has-unit-tests
Focuses: rest-api Cc:

Description

Change params on wp_image_file_matches_image_meta function for better reusability and more context to the filter.

Change History (6)

This ticket was mentioned in PR #423 on WordPress/wordpress-develop by spacedmonkey.


5 years ago
#1

  • Keywords has-unit-tests added

#2 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 5.5

#3 @spacedmonkey
5 years ago

The filter wp_image_file_matches_image_meta being passed the $attachment_id is important for plugins like jetpack that have custom image urls.

#4 @SergeyBiryukov
5 years ago

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

If the goal is to provide pass the $attachment_id parameter to the wp_image_file_matches_image_meta filter, it seems like the best way forward would be to pass it along with $image_meta to the function.

That would be consistent with a few existing functions:

  • wp_calculate_image_srcset()
  • wp_calculate_image_sizes()
  • wp_image_add_srcset_and_sizes()

#5 @SergeyBiryukov
5 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 48547:

Media: Pass the attachment ID to the wp_image_file_matches_image_meta filter.

Props spacedmonkey.
Fixes #50722.

Note: See TracTickets for help on using tickets.