[wp-trac] [WordPress Trac] #51261: Integrate the -scaled.jpg images setting into _wp_make_subsizes

WordPress Trac noreply at wordpress.org
Mon Sep 7 15:31:24 UTC 2020


#51261: Integrate the -scaled.jpg images setting into _wp_make_subsizes
--------------------------+-----------------------------
 Reporter:  ddegner       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51261>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list