Make WordPress Core

Opened 7 years ago

Last modified 5 years ago

#44456 new defect (bug)

srcset max-width set to image width

Reported by: mikedunn's profile mikedunn Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.6
Component: Media Keywords:
Focuses: Cc:

Description

My understanding is the max-width value in the image srcset should be limited to 1600px, however it is actually always set to the width of the original image. Also, max_srcset_image_width does not appear to be properly setting the max-width value either.

Thanks,
Mike

Change History (1)

#1 @sabernhardt
5 years ago

  • Component changed from General to Media

Hi and thanks for the ticket!

I'm setting the component to Media for better visibility.

It's worth noting that the max-width value can be filtered using wp_calculate_image_sizes for content images (or wp_get_attachment_image_attributes for featured images). See Twenty Sixteen theme for an example.

Also, since WordPress 5.3, original images (JPEGs) can be scaled when uploaded. The default maximum dimension is 2560px, and the big_image_size_threshold filter can adjust that value.

Note: See TracTickets for help on using tickets.