Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#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
Priority: normal Milestone: 4.7.1
Component: Media Version: 4.7
Severity: normal Keywords: has-patch has-unit-tests fixed-major
Cc: Focuses:

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 10 years ago.
Process add_image_sizes() also.
39231.diff​ (3.3 KB ) - added by joemcgill 10 years ago.

Download all attachments as: .zip

Change History (10)

@gitlost
10 years ago

Process add_image_sizes() also.

@joemcgill
10 years ago

#1 @joemcgill
10 years ago

  • Keywords has-patch has-unit-tests added
  • Milestone Awaiting Review → 4.7.1
  • Owner set to joemcgill
  • Status new → 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
10 years ago

Looks good to me!

#3 @joemcgill
10 years ago

#39263 was marked as a duplicate.

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


10 years ago

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


10 years ago

#6 @joemcgill
10 years ago

  • Resolution → fixed
  • Status accepted → 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
10 years ago

  • Keywords fixed-major added
  • Resolution fixed
  • Status closed → reopened

Reopened for the 4.7 branch.

#8 @pento
10 years ago

  • Resolution → fixed
  • Status reopened → 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.