WordPress.org

Make WordPress Core

Opened 18 months ago

Last modified 8 months ago

#43531 new defect (bug)

$content_width and Add Media (+ twentyseverteen?)

Reported by: ChiefAlchemist Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.4
Component: Media Keywords: ux-feedback
Focuses: Cc:

Description

I apologize in advance if this isn't a bug. However, I couldn't seem to find any documentation on the expected behavior (e.g., there's nothing on the codex page for the image_size_names_choose filter). None the less, it certainly feels odd / awkward.

When adding an image (to a post / page), the size setting select (Add Media > Attachment Display Setting > Size) doesn't feel quite right. I understand the relationship between (global) $content_width and this setting. That is, the <img> tag's width= is forced / maxed to the $content_width (if the image is wider than the $content_width).

I see this happening for the size = large images, as well as any image sizes I've added via add_image_size() that are too wide. However, it (i.e., the forced max width=) doesn't happen to the size Medium when the Medium width is set wider than the content width.

Perhaps this is intentional?

Theme was twentyseventeen. Unfortunately, I've haven't had time to try to reproduce this on another theme. The size Medium was set to 800 x 800.

I'd like to suggest the Settings > Media page display the current $content_width, as well as explain a bit, as well as link to a deeper explanation. As it is, a user can select a theme, blindly set the image sizes (not realizing who they actually map to the theme), and then be hit with the experience (?) described above, AND have no idea why.

Truth be told, it took me too long to figure this out. Somehow I've managed to avoid $content_width. Too many custom themes maybe? :)

Or am I just missing something about the intent of what otherwise feels like a sloppy experience?

I hope this helps. TIA

Change History (4)

#1 @melchoyce
18 months ago

  • Keywords ux-feedback added

#2 @joyously
8 months ago

I'd like to suggest the Settings > Media page display the current $content_width, as well as explain a bit, as well as link to a deeper explanation. As it is, a user can select a theme, blindly set the image sizes (not realizing who they actually map to the theme), and then be hit with the experience (?) described above, AND have no idea why.

The problem with this is the sizes on Settings > Media page applies only to images uploaded after you change the sizes. And the content width is different for every theme, which can be switched at any time, including programmatically for each page (like a Theme Switcher plugin). And the actual width is different for every visitor's device window.

This is why there is another ticket to remove the image size options, since the sizes computed for the browser to choose from are based on the largest uploaded.

I don't think adding explanation here will be helpful when the thing being explained is a moving target.

#3 @ChiefAlchemist
8 months ago

@joyously said

"This is why there is another ticket to remove the image size options, since the sizes computed for the browser to choose from are based on the largest uploaded."

A link to this ticket / discussion would be a big help.

"I don't think adding explanation here will be helpful when the thing being explained is a moving target."

Okay. But where then? It's not in the codex and it is media + theme related.

tia

#4 @joyously
8 months ago

The ticket for removing image sizes is #44441.

I don't think it needs explanation at all. I couldn't even figure out what you were talking about (a succinct statement of the problem). There are many things that WordPress does not explain, and how to leave the image sizing to the browser could be one of them.

Note: See TracTickets for help on using tickets.