#36531 closed defect (bug) (fixed)
Default image size medium_large is not generated
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.5.3 | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | Media | Keywords: | has-patch fixed-major |
Focuses: | administration | Cc: |
Description
With default image sizes in the media settings page, five sizes of an uploaded image is generated; 150px, 300px, 768px, 1024px and 1200px, using Twenty Sixteen. Changing one of the image sizes will cause WordPress to stop generating the medium_large 768px image.
I suspect the medium_large size image is somehow set to zero in the database when changing media settings in WP admin, thus not generated.
Tested with WordPress 4.4.2 and 4.5, server PHP 5.6.10 / MySQL 5.5.42, no plugins in the plugins folder, Twenty Sixteen, Twenty Fifteen and other themes as well. Language set to Norwegian in WP admin. Tested locally and online with Chrome version 49.0.2623.112 (64-bit) and Firefox 45.0.2.
Attachments (1)
Change History (16)
#2
@
9 years ago
- Owner set to joemcgill
- Status changed from new to reviewing
Thanks for the report @Indent and @adamsilverstein for confirming. This bug has probably existed since the new size was introduced in r35479.
#3
follow-up:
↓ 7
@
9 years ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 4.6
- Status changed from reviewing to accepted
Looks like any time the media options are saved (wp-admin/options-media.php) the values for medium_large_size_h
and medium_large_size_w
are being set to null
because no value for that option exists in the $_POST
request. The problem is in this section of options.php
:
$value = null; if ( isset( $_POST[ $option ] ) ) { $value = $_POST[ $option ]; if ( ! is_array( $value ) ) $value = trim( $value ); $value = wp_unslash( $value ); } update_option( $option, $value );
36531.diff removes medium_large_size_h
and medium_large_size_w
from the whitelist of media options that can be updated so this won't happen going forward, but we would still need to run a DB routine to reset this option if it has been set to null.
This ticket was mentioned in Slack in #core-images by joemcgill. View the logs.
9 years ago
This ticket was mentioned in Slack in #core by joemcgill. View the logs.
9 years ago
#7
in reply to:
↑ 3
@
9 years ago
Replying to joemcgill:
Looks like any time the media options are saved (wp-admin/options-media.php) the values for
medium_large_size_h
andmedium_large_size_w
are being set tonull
because no value for that option exists in the$_POST
request.
That's right, but it gets stored as 0
because of sanitize_option()
which does $value = absint( $value );
for both options. So, for an upgrade routine we can't detect if the change was intentionally or not.
This ticket was mentioned in Slack in #core-images by joemcgill. View the logs.
9 years ago
#9
@
9 years ago
- Milestone changed from 4.6 to 4.5.3
Thanks @ocean90. I'd like to get the patch in 4.5.3, if possible, so we at least stop this issue from spreading further. We can circle back and decide whether we do an upgrade routine in a future release. If so, we should only target installs that have medium_large_size_h
and medium_large_size_w
set to 0
.
#12
@
9 years ago
- Keywords fixed-major added
- Resolution fixed deleted
- Status changed from closed to reopened
This ticket was mentioned in Slack in #core by adamsilverstein. View the logs.
9 years ago
#15
@
9 years ago
I've encountered this issue in a slightly different scenario. The 36531.diff fixes it, but I figured I'd share in case it's useful.
<?php add_image_size('large-xl', 1600,1600, false);
I'm generating additional image sizes. The images are getting created on upload, but their meta is not being added to the attachment meta, only the default sizes. Perhaps it's related because i'm not cropping the image?
You can see all image sizes are being generated.
But the sizes meta data is not.
Again, applying the patch fixes the issue.
@Indent Thanks for the bug report.
I tested and was able to reproduce the issue as you described it: I no longer see the 768x image size after making a change in the settings. The may be related to some of the responsive image changes we have been working on, hopefully @joemcgill can take a look and shed some light.
Before changing any settings:

Changing medium size media setting to 400x300 and uploading the same file results in one less file being created: the 768x size is missing: