Make WordPress Core

Opened 4 years ago

Last modified 4 years ago

#51261 new enhancement

Integrate the -scaled.jpg images setting into _wp_make_subsizes

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


Creating a -scaled.jpg BIG threshold image on upload is a good idea, but it has been implemented in a way that makes it hard to adjust, try out different settings, or unify the look of the site.

After a photo has been scaled once I can't find a way to regenerate the scaled version, even using plugins and digging through the image.php file. It appears that after it has been scaled once there is a marker that prevents the images from being scaled again with different settings.

The -scaled.jpg image needs to be integrated into _wp_make_subsizes so that they can be regenerated if necessary. Also if the -scaled.jpg image settings were placed in the settings>media pane like all the other default image sizes it would make for easier adjustments.

The current implementation leaves websites where pre-5.3 posts serve full-sized images and post-5.3 posts serve scaled images. And if the default scale isn't ideal there is no way to re-create the previously scaled images.

--- Here are my attempts to work around this lack of functionality

While developing my wordpress site I had the "Disable "BIG image" Threshold" plugin installed half the time. So half of my images had a -scaled.jpg version and half didn't.

I found the default -scaled.jpg size to be too small so I want to use the "Regenerate Thumbnails" plugin to regen all the images to have a -scaled version. I removed the "Disable "Big Image"" plugin and added this to my function.php file.

function td_big_image_size_threshold( $threshold, $imagesize, $file, $attachment_id ) {
return 4000;
add_filter( 'big_image_size_threshold', 'td_big_image_size_threshold', 10, 4 );

I ran the Regenerate plugin and it half worked, creating -scaled.jpg images, for the half of the attachments that didn't previously have them, but didn't overwrite the previously created -scaled.jpg images.

I thought the updated pixel metadata of the -scaled.jpg images might be below the threshold so I went into the images.php file and temporarily removed the

if($image_meta['width'] > X etc){}

part of the check. It didn't work. Now I can't find a way to force a regenerated -scaled version of of the images. It is as if once they have been scaled once, even if those files are removed or the scale has changed they can't be scaled again.

I'm at a loss. I feel like running the _wp_image_meta_replace_original function over my whole library to reset them would be the best option but don't really know how to do that.

Change History (2)

#1 @helen
4 years ago

  • Type changed from defect (bug) to enhancement
  • Version changed from trunk to 5.3

Setting version to 5.3 as I believe it's related to that feature, have pinged for media component triage.

This ticket was mentioned in Slack in #core-media by antpb. View the logs.

4 years ago

Note: See TracTickets for help on using tickets.