Opened 2 months ago
Last modified 6 weeks ago
#23779 new defect (bug)
Can't insert large image if it's smaller than media setting but larger than theme setting
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.6 |
| Component: | Media | Version: | 3.0 |
| Severity: | normal | Keywords: | has-patch |
| Cc: |
Description
If you upload an image that is larger than $content_width but not larger than the "large" setting in settings->media, the option to insert a "large" image into the post isn't available even though the image is large enough.
It looks like it must use $content_width as the actual width of the large image that's inserted, and the large_size_w setting to decide whether to show that option or not.
Attachments (1)
Change History (7)
comment:1
SergeyBiryukov — 2 months ago
comment:2
SergeyBiryukov — 2 months ago
- Keywords reporter-feedback added
comment:3
aaroncampbell — 2 months ago
- Keywords reporter-feedback removed
When it creates the dropdown and when it inserts the image into the post it uses $content_width, a theme-defined global variable, if it exists.
To see what I mean, enable Twenty Twelve which uses $content_width = 625, and leave your media setting for large to the default 1024. Now upload an image that is wider than 1024 and you will get the option to insert the large image into the post but the width will be 625. Now upload an image that is 800px wide (or something between 625 and 1024) and you don't have the large option. Instead you have to insert the full-size and then resize it.
I've had several users that were really frustrated by this. The workaround is pretty easy (just set the media settings to match the theme), but it's not very obvious. They expect to be able to use the large option if the image they upload is larger than what they always see as the "large" option (which is $content_width).
- Milestone changed from Awaiting Review to 3.6
This is really interesting. Took me a bit to fully understand it.
Is this reproducible in 3.4?
I was able to reproduce in trunk and 3.4.
Starting work on a patch.
- Keywords has-patch added
- Version changed from 3.5 to 3.0
Reproduced in 3.0. 23779.diff uses the original image metadata if a size's metadata is not available, and performs a check before adding the size, to make sure we don't see duplicate sizes when full and large are equal.

If the uploaded image is smaller than Large size in media settings, the large size is not generated. Since wp_prepare_attachment_for_js() only fills in the sizes that actually exist for the image, the Large option is in unavailable in the dropdown.
Or am I missing something?