[wp-trac] [WordPress Trac] #54648: Filter to let define the quality on subsize images

WordPress Trac noreply at wordpress.org
Fri Dec 17 16:19:39 UTC 2021


#54648: Filter to let define the quality on subsize images
-------------------------+-----------------------------
 Reporter:  Mte90        |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Media        |    Version:
 Severity:  normal       |   Keywords:
  Focuses:  performance  |
-------------------------+-----------------------------
 Talking with https://profiles.wordpress.org/codekraft/ we was wondering if
 it is possible to get a filter to specify the quality of subsized images.

 Right now the `wp_update_image_subsizes` https://github.com/WordPress
 /wordpress-develop/blob/cdd5e43a04930bac390537944eb6f4256d364bd4/src/wp-
 admin/includes/image.php#L153 doesn't have that filter.

 So on `wp_create_image_subsizes` https://github.com/WordPress/wordpress-
 develop/blob/cdd5e43a04930bac390537944eb6f4256d364bd4/src/wp-
 admin/includes/image.php#L228 calls `_wp_make_subsizes`
 https://github.com/WordPress/wordpress-
 develop/blob/cdd5e43a04930bac390537944eb6f4256d364bd4/src/wp-
 admin/includes/image.php#L386

 But doesn't specify the quality.
 Probably the best solution is to use `set_quality` of the Image Editor
 ImageMagick/GD classes in the last function.

 This can help, in our thoughts, on generate smallest images (like under
 200x200) with a different compression that can be more strong, compared to
 the others, as they have a different usage and the quality of those can be
 different.
 This can save space and speed up the page.

 Some examples? In the woocommerce gallery where there are the preview as
 tiny squares (150x150).

 Maybe this idea can interest the new Performance team?

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


More information about the wp-trac mailing list