Skip to content

Conversation

@pereirinha
Copy link
Contributor

This will allow applying the default transformations when calling the_post_thumbnail().

Description This will allow apply the default transformations when calling the_post_thumbnail()
Copy link
Contributor

@dugajean dugajean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution looks clean to me, but could you explain how this fixes the issue at hand?

@DavidCramer
Copy link
Contributor

@dugajean - the the_post_thumbnail() calls the image_downsize filter which allows us to replace a sized URL for an image. The problem with that is that we filter this by converting the URL, which is an exact copy without global transformations, since convert_url was initially made to convert breakpoints by passing an array of transformations from the parent.
The result is a clean, untransformed URL.

The flag that @pereirinha added, lets us selectively tell it to apply globals transformations, with it set to false in the breakpoint context.

This however is only a partial fix, since it doesn't take into account if the featured image has it's own transformations. I have pushed a fix that uses the correct way, by converting the primary URL, and having the breakpoints part be an accessory rather than an override.
I also renamed the $breakpoint flag to better explain it's purpose; Overwrite Transformations

@DavidCramer DavidCramer requested a review from dugajean April 24, 2020 08:15
@dugajean
Copy link
Contributor

Got it @DavidCramer, thanks for explaining. 😄

@DavidCramer DavidCramer merged commit dcd865e into develop Apr 25, 2020
@pereirinha pereirinha deleted the feature/CLOUD-388 branch June 5, 2020 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants