Photon: Iterate on sizes array for themes without content_width
Here's the layout before 4.0.4:

Here's after:

Photon decided to introduce a max-width of 1000...
Disabled Photon for now, but would love to get it back.
You can see my specific code here - http://rothschildportraiture.com - built with Beaver Builder.
What I expected
Smooth minor update
What happened instead
Full width designs got messed up
Steps to reproduce the issue
Enable photon. Use beaver builder to add a full width image. (adding a row with a full width image background still works though...)
@rothschild86 - Can you try adding this to your theme's child theme or a functionality plugin:
add_filter( 'jetpack_content_width', 'set_jp_cw' );
function set_jp_cw( $width ){
if ( ! $width ){
$width = 2000;
}
return $width;
}
We put 1000 as a default for themes that have not set a $content_width for use with WordPress' responsive images.
Yeah, that worked fine. Thank you for a response, Brandon. I'm sure I won't be the last person to ask this.
Reopening for further investigation and examination of themes that do not set a content width (we tested a number of them already, but hadn't seen this particular type of usage).
One thought: If there's not a content width, do nothing. This would roll back the enhancements added in 4.0.4 (which attempted to prevent, in some cases, some extremely large images from being downloaded by the browser).
For the record, theme used: Genesis: Altitude Pro.
Is there a way to set it to device width instead of hard coding a value?
I'm working with StudioPress (I'm in their private repo) since they're the biggest shop that I've seen not actively use content_width.
You could set it to 99999999. For the purposes of Photon, it would max out at the images full-size. I haven't, to be frank, tested that approach on other pieces of Jetpack that user the Jetpack filter for the content width, though. Might be a place we need to add a new filter to target this usage specifically.
I can confirm that setting jetpack_content_width to 99999999 causes jetpack-video-wrapper to set a height of 0
We're still discussing it, but may look at only implementing a default width when srcset'ing strictly for images within the post_content, not others., which may reach the goal of providing better performance for all sites while avoiding issues like this.
The sizes array: We should likely abort out for images not within the_content. p1HpG7-3nY-p2
@rothschild86 - FYI - I haven't tested #4226 against your setup (Beaver Builder does not appear to have a free version for testing), but I'm not expecting it to resolve it since those images are still within the content. #4226 fixes a related, but not wholly duplicative issue
BB Lite is free - https://wordpress.org/plugins/beaver-builder-lite-version/
Thinking of it... It would be nice if skipping could be activated by setting a certain css class on an image (very easy to do with BB)...
meanwhile, a mental note to self - tweak the original hack above to activate only on certain pages that use BB and take advantage of srcset on the rest of the site...
so for now the hack looks like this:
add_filter( 'jetpack_content_width', 'set_jp_cw' );
function set_jp_cw( $width ){
$full_width_page_ids = array(2147,2170);
if ( ! $width && in_array(get_the_ID(), $full_width_page_ids)){
$width = 2000;
}
return $width;
}
I'm using a theme that was customized to allow specific images to be oversized within the_content, using a version of the outdentImages function in Intergalactic ( lines 36-61 in intergalactic.js ) The theme separately declares $content_width and $jetpack_content_width so the added class is specific to those images.
Is there any way to filter the default independent of $content_width and $jetpack_content_width?
as predicted, the hack is still needed in 4.1
Also reported here: https://wordpress.org/support/topic/422-photon-resizing-to-wrong-size/#post-8209438
Also reported here: https://wordpress.org/support/topic/image-resize-crop-and-rotation-problems-with-photon/
Also reported here: https://wordpress.org/support/topic/image-width-in-single-post/
Reported in 3309777-t
Also in 1057305-zen
This issue has been marked as stale. This happened because:
- It has been inactive in the past 6 months.
- It hasn’t been labeled `[Pri] Blocker`, `[Pri] High`.
No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.
1615590-zen