-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Photon: srcset to use custom thumbnail sizes #3040
Conversation
That said, I'm not sure if this approach is better/worse than something like 1ffcec2 or neither. |
This is no good. You can have multiple custom thumbs of the same width. Assuming no Core changes, the other commit method is probably better. Let Core decide which image sizes to use and roll from there. |
Core Slack chatter about if this approach seems sane to @joemcgill and asking about viability of a Core patch to make the dims easier to grab: https://wordpress.slack.com/archives/feature-respimg/p1447899460000167 |
Core ticket that would enhance the filter and would be beneficial to us: https://core.trac.wordpress.org/ticket/34736 |
If 34736 doesn't land before 4.4 I would recommend looking at an option similar to 5be08ef but matching the the Not necessarily related, but you might be able to speed your filter up a bit by grabbing the full size image directly from |
@@ -579,17 +579,24 @@ public function filter_image_downsize( $image, $attachment_id, $size ) { | |||
* @uses self::validate_image_url, jetpack_photon_url | |||
* @return array An array of Photon image urls and widths. | |||
*/ | |||
public function filter_srcset_array( $sources ) { | |||
public function filter_srcset_array( $sources, $size_array, $image_src, $image_meta, $attachment_id ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need these extra parameters here? I can't see any place where they are being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They can be removed from both lines. Added to make exploring options to fix faster, but in the end nothing helpful there for the final proposal. Thanks for catching it, can remove in a few hours if you don't get to it first.
Read the discussion, tested the changes, this looks good except one thing I commented about earlier. |
…ntermediate size We get the full-size image of the post thumbnail if the intermediate size is unreachable, or too small for the size set by the theme. This fixes images distorting to fit the post-thumbnail container
eb94c1f
to
86b2353
Compare
Photon: srcset to use custom thumbnail sizes
If there are existing custom thumbnails at the matching size, we should use those instead.
Fixes #2919
Enhances #2885 See #2804