WordPress.org

Make WordPress Core

#39231 closed defect (bug) (fixed)

Allow the pdf fallback_intermediate_image_sizes filter to process add_image_size() sizes.

Reported by: gitlost Owned by: joemcgill
Milestone: 4.7.1 Priority: normal
Severity: normal Version: 4.7
Component: Media Keywords: has-patch has-unit-tests fixed-major
Focuses: Cc:

Description

The fallback_intermediate_image_sizes filter added in #38594 only works for default get_option sizes and not user-defined add_image_size() sizes, unlike the intermediate_image_sizes_advanced filter. It'd be more useful if it could work with user-defined sizes also. My particular use case is adding a plugin-defined list thumbnail size, smaller than the default thumbnail size.

The following patch just copies the (before) logic used for intermediate_image_sizes_advanced to the (after) logic of fallback_intermediate_image_sizes. It includes a unittest.

Attachments (2)

39231.patch (3.8 KB) - added by gitlost 12 months ago.
Process add_image_sizes() also.
39231.diff (3.3 KB) - added by joemcgill 12 months ago.

Download all attachments as: .zip

Change History (10)

@gitlost
12 months ago

Process add_image_sizes() also.

@joemcgill
12 months ago

#1 @joemcgill
12 months ago

  • Keywords has-patch has-unit-tests added
  • Milestone changed from Awaiting Review to 4.7.1
  • Owner set to joemcgill
  • Status changed from new to accepted

Good catch @gitlost. You're correct that the filter isn't very useful for custom sizes if we don't take steps to check for them later. For the test, I would prefer a simple check that the filter was run, rather than making the filter conditional on the existence of the large size, in case that were to change later. What would you think of 39231.diff?

#2 @gitlost
12 months ago

Looks good to me!

#3 @joemcgill
12 months ago

#39263 was marked as a duplicate.

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


12 months ago

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


12 months ago

#6 @joemcgill
12 months ago

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

In 39617:

Media: Allow PDF fallbacks filter to process custom sizes.

This fixes an oversight in [39246], which added a hook for filtering
the array of sizes used for PDF thumbnails, but failed to provide a way
for sizes added through add_image_size() to be processed.

Props gitlost.
Fixes #39231. See #38594.

#7 @joemcgill
12 months ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopened for the 4.7 branch.

#8 @pento
12 months ago

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

In 39633:

Media: Allow PDF fallbacks filter to process custom sizes.

This fixes an oversight in [39246], which added a hook for filtering the array of sizes used for PDF thumbnails, but failed to provide a way for sizes added through add_image_size() to be processed.

Merge of [39617] to the 4.7 branch.

Props gitlost.
Fixes #39231. See #38594.

Note: See TracTickets for help on using tickets.