[wp-trac] [WordPress Trac] #54476: Improve image engine detection when output format adjusted with filter (example: WebP output)

WordPress Trac noreply at wordpress.org
Fri Sep 30 23:50:14 UTC 2022


#54476: Improve image engine detection when output format adjusted with filter
(example: WebP output)
--------------------------------------------+------------------------------
 Reporter:  adamsilverstein                 |       Owner:  adamsilverstein
     Type:  defect (bug)                    |      Status:  assigned
 Priority:  normal                          |   Milestone:  6.1
Component:  Media                           |     Version:  5.8
 Severity:  normal                          |  Resolution:
 Keywords:  has-patch needs-testing commit  |     Focuses:
--------------------------------------------+------------------------------

Comment (by ironprogrammer):

 == Test Report
 This report combines reproduction and patch testing.

 Patch tested:
 https://core.trac.wordpress.org/attachment/ticket/54476/54476.4.diff

 === Steps to Reproduce
 1. Install [https://wordpress.org/plugins/modern-images-wp/ Modern Images
 WP] plugin (conveniently sets output format via the
 `image_editor_output_format` filter mentioned in [#ticket original
 report]).
 2. In ''Settings > Media'', configure plugin to set "For jpeg images" to
 "WebP". Click **Save Changes**.
 3. Navigate to ''Tools > Site Health'', **Info** tab, and expand the
 **Media Handling** section.
 3. If the "ImageMagick supported file formats" section lists `WEBP`, apply
 [https://core.trac.wordpress.org/attachment/ticket/54476/shim-for-
 testing.diff shim-for-testing.diff] provided by @adamsilverstein (this
 disables `WEBP` support in ImageMagick). Refresh page after patching to
 confirm `WEBP` is no longer in the list of formats.
 4. In ''Media'', upload a JPEG file (either `.jpg` or `.jpeg` extension).
 5. On the file system or command line, navigate to the WordPress uploads
 directory and observe the alternate size files that were generated.

 === Expected Results
 - ❌ The alternate size images generated are JPEG, not WebP as configured
 by the plugin (filter).

 === Environment
 - Hardware: MacBook Pro Apple M1 Pro
 - OS: macOS 12.6
 - Browser: Safari 16.0
 - Server: nginx/1.23.1
 - PHP: 7.4.30
 - WordPress: 6.1-beta2-54337-src
 - Theme: twentyseventeen v3.0
 - Active Plugins:
  - modern-images-wp v1.0.3

 === Actual Results
 - ❌ Before patch, issue reproduced: observed that JPEG images were saved
 as JPEG (original format).
 - ✅ After patch, JPEG images were saved as WebP, as set by the plugin's
 `image_editor_output_format` filter.

 === Supplemental Artifacts
 ''Site Health Media Handling section, showing no WebP support (with shim
 applied):''
 [[Image(https://cldup.com/z3gFV9jXT6.thumb.jpg, 90%)]]

 ''Modern Images WP configuration for JPEG, configured for output to WebP
 (note that WebP support is listed here, though has been disabled, as
 visible in Site Health):''
 [[Image(https://cldup.com/sWJg5uqbXZ.thumb.jpg, 70%)]]

 ''❌ Before patch: output to WebP is not honored:''
 [[Image(https://cldup.com/qSqQwPPfNE.thumb.jpg, 80%)]]

 ''✅ After patch: output to WebP is honored:''
 [[Image(https://cldup.com/XZuXHvJnQ2.thumb.jpg, 80%)]]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54476#comment:27>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list