Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#53724 closed defect (bug) (worksforme)

image conversion from jpg to webp no longer working

Reported by: martinvonberg's profile martinvonberg Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.8
Component: Media Keywords:
Focuses: Cc:

Description

In preparation for WP 5.8 I tested the new filter 'image_editor_output_format' as described. It worked with WP5.8-RC4 from 2021-07-17. No Problems at all. After the update to WP5.8 the 2021-07-21 the images are no longer converted. Tested on local site, staging site and productive site. The used code is:

<?php
add_filter( 'image_editor_output_format', function( $formats ) {
        $formats['image/jpeg'] = 'image/webp';
        return $formats;
        } 
);

The servers environment is show in the attached file of the wp health check. No server setting was changed between the test and the update. I double checked to attach the code to a mu-plugin, a separate plugin and the functions.php.

The webp support is great, so I wanted to use it immediately.

Best Regards
Martin

Attachments (1)

WP-site-health-status.txt (6.4 KB) - added by martinvonberg 3 years ago.
Report of WP site health checker

Download all attachments as: .zip

Change History (18)

@martinvonberg
3 years ago

Report of WP site health checker

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


3 years ago

#2 @antpb
3 years ago

  • Keywords reporter-feedback added

Hey there @martinvonberg ! Thanks for your report! I noticed in your site health status that there are some image optimization plugins installed on your site. In particular one WebP converter is in your active plugins list. Is it possible for you to test again with any media altering plugins disabled to help identify where the disconnect is? It is certainly strange that this worked for your prior to the update.

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


3 years ago

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


3 years ago

#5 @alanjacobmathew
3 years ago

Hi,

I was able to reproduce the issue with no plugins installed, v:5.8 and TwentyTwenty Theme.

It is interesting to note that some images are converted to webP while some stays as JPEG. I used images from Unsplash and same image with different dimensions get different result.

Unsplash Image 1: https://unsplash.com/photos/3NJ3fLmKXGY

Image doesn't get converted to WebP unless the image downloaded is in it 'Original Size'

Unsplash Image 2: https://unsplash.com/photos/1XKOnsxF1-M

Image get converted even downloaded with 'Medium Size'

Also noticed that most of the images that gets converted has an min dimension of[abc by 1697] pixels (ie. inside WP media)

#6 @martinvonberg
3 years ago

Hi,
I did the same now: bare V5.8 without any plugins, Theme: 2021.
Necessary code is in functions.php from Theme 2021.
Images are not converted from jpg to webp.
Upload of *.webp is resized to the defined image subsizes.
Best Regards
Martin

Health Report (directly copied, as I can't add another file):

`
### wp-core ###

version: 5.8
site_language: de_DE
user_language: de_DE
timezone: Europe/Berlin
permalink: /%postname%/
https_status: true
multisite: false
user_registration: 0
blog_public: 1
default_comment_status: open
environment_type: production
user_count: 1
dotorg_communication: true

### wp-paths-sizes ###

wordpress_path: /var/www/web123/html/wordpress_test/wordpress
wordpress_size: 49,54 MB (51948667 bytes)
uploads_path: /var/www/web123/html/wordpress_test/wordpress/wp-content/uploads
uploads_size: 65,46 MB (68640422 bytes)
themes_path: /var/www/web123/html/wordpress_test/wordpress/wp-content/themes
themes_size: 17,35 MB (18190325 bytes)
plugins_path: /var/www/web123/html/wordpress_test/wordpress/wp-content/plugins
plugins_size: 22,44 MB (23531398 bytes)
database_size: 778,15 kB (796824 bytes)
total_size: 155,55 MB (163107636 bytes)

### wp-active-theme ###

name: Twenty Twenty-One (twentytwentyone)
version: 1.3
author: WordPress-Team
author_website: https://de.wordpress.org/
parent_theme: none
theme_features: core-block-patterns, widgets-block-editor, automatic-feed-links, title-tag, post-formats, post-thumbnails, menus, html5, custom-logo, customize-selective-refresh-widgets, wp-block-styles, align-wide, editor-styles, editor-style, editor-font-sizes, custom-background, editor-color-palette, editor-gradient-presets, responsive-embeds, custom-line-height, experimental-link-color, custom-spacing, custom-units, widgets
theme_path: /var/www/web123/html/wordpress_test/wordpress/wp-content/themes/twentytwentyone
auto_update: Deaktiviert

### wp-media ###

image_editor: WP_Image_Editor_Imagick
imagick_module_version: 1673
imagemagick_version: ImageMagick 6.8.9-9 Q16 x86_64 2019-12-29 http://www.imagemagick.org
imagick_version: 3.4.3
file_uploads: File uploads is turned off
post_max_size: 96M
upload_max_filesize: 32M
max_effective_size: 32 MB
max_file_uploads: 20
imagick_limits:

imagick::RESOURCETYPE_AREA: 96 GB
imagick::RESOURCETYPE_DISK: -1
imagick::RESOURCETYPE_FILE: 6144
imagick::RESOURCETYPE_MAP: 96 GB
imagick::RESOURCETYPE_MEMORY: 48 GB
imagick::RESOURCETYPE_THREAD: 1

imagemagick_file_formats: 3FR, AAI, AI, ART, ARW, AVI, AVS, BGR, BGRA, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FITS, FRACTAL, FTS, G3, GIF, GIF87, GRADIENT, GRAY, GROUP4, GV, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, ICB, ICO, ICON, INFO, INLINE, IPL, ISOBRL, JBG, JBIG, JNG, JNX, JPEG, JPG, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MEF, MIFF, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV
gd_version: bundled (2.1.0 compatible)
gd_formats: GIF, JPEG, PNG, WebP, BMP, XPM
ghostscript_version: 9.26

### wp-server ###

server_architecture: Linux 4.15.18-13-pve x86_64
httpd_software: Apache
php_version: 7.4.3 64bit
php_sapi: cgi-fcgi
max_input_variables: 1000
time_limit: 90
memory_limit: 384M
max_input_time: 60
upload_max_filesize: 32M
php_post_max_size: 96M
curl_version: 7.38.0 OpenSSL/1.0.1t
suhosin: false
imagick_availability: true
pretty_permalinks: true
htaccess_extra_rules: false

### wp-database ###

extension: mysqli
server_version: 5.7.25
client_version: mysqlnd 7.4.3

### wp-constants ###

WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /var/www/web123/html/wordpress_test/wordpress/wp-content
WP_PLUGIN_DIR: /var/www/web123/html/wordpress_test/wordpress/wp-content/plugins
WP_MEMORY_LIMIT: 40M
WP_MAX_MEMORY_LIMIT: 384M
WP_DEBUG: false
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: false
SCRIPT_DEBUG: false
WP_CACHE: false
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_LOCAL_DEV: undefined
DB_CHARSET: utf8mb4
DB_COLLATE: undefined

### wp-filesystem ###

wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable

`

#7 @martinvonberg
3 years ago

Update:
It works on my messy, chaotic local test-site with the same image converting from jpg to webp (and the same code).
The only significant difference I can see, that my local (see report below):

  • doesn't have imagick, so it uses GD and
  • PHP version is 7.3.x instead of 7.4. on my "real" server.

I will switch now to PHP 8.0.x to force GD on my server (no imagick for PHP8)

`
### wp-core ###

version: 5.8
site_language: de_DE
user_language: de_DE
timezone: +01:00
permalink: /%category%/%postname%/
https_status: false
multisite: false
user_registration: 0
blog_public: 1
default_comment_status: open
environment_type: production
user_count: 3
dotorg_communication: true

### wp-paths-sizes ###

wordpress_path: C:\Bitnami\wordpress-5.2.2-0\apps\wordpress\htdocs
wordpress_size: 63,45 MB (66528172 bytes)
uploads_path: C:\Bitnami\wordpress-5.2.2-0\apps\wordpress\htdocs/wp-content/uploads
uploads_size: 879,63 MB (922362074 bytes)
themes_path: C:\Bitnami\wordpress-5.2.2-0\apps\wordpress\htdocs/wp-content/themes
themes_size: 47,05 MB (49331753 bytes)
plugins_path: C:\Bitnami\wordpress-5.2.2-0\apps\wordpress\htdocs/wp-content/plugins
plugins_size: 88,60 MB (92902431 bytes)
database_size: 12,09 MB (12681216 bytes)
total_size: 1,07 GB (1143805646 bytes)

### wp-dropins (1) ###

db.php: true

### wp-active-theme ###

name: AcmePhoto (acmephoto)
version: 3.0.3
author: acmethemes
author_website: https://www.acmethemes.com/
parent_theme: none
theme_features: core-block-patterns, widgets-block-editor, automatic-feed-links, title-tag, custom-logo, post-thumbnails, menus, html5, custom-background, woocommerce, align-wide, wp-block-styles, widgets
theme_path: C:\Bitnami\wordpress-5.2.2-0\apps\wordpress\htdocs/wp-content/themes/acmephoto
auto_update: Deaktiviert

### wp-themes-inactive (23) ###

Catch Responsive: version: 2.7.8, author: Catch Themes, Automatische Aktualisierungen deaktiviert
Di Blog: version: 1.3.5, author: dithemes (latest version: 1.3.6), Automatische Aktualisierungen deaktiviert
Elemento Photography: version: 1.0.10, author: Greenturtlelab, Automatische Aktualisierungen deaktiviert
Elemento: version: 1.3.2, author: Greenturtlelab, Automatische Aktualisierungen deaktiviert
Fabulous Fluid: version: 1.9, author: Catch Themes, Automatische Aktualisierungen deaktiviert
Galore: version: 1.1.6, author: Shark Themes, Automatische Aktualisierungen deaktiviert
Hitchcock: version: 2.0.2, author: Anders Norén, Automatische Aktualisierungen deaktiviert
Photo Perfect Child: version: 1.0.0, author: Martin von Berg, Automatische Aktualisierungen deaktiviert
Photo Perfect: version: 1.9.2, author: WEN Themes, Automatische Aktualisierungen deaktiviert
PhotoBlogster: version: 5.3, author: lighthouseseo, Automatische Aktualisierungen deaktiviert
Travel Blogs: version: 1.0.0, author: DiThemes, Automatische Aktualisierungen deaktiviert
Twenty Eleven: version: 3.7, author: WordPress-Team (latest version: 3.8), Automatische Aktualisierungen deaktiviert
Twenty Fifteen: version: 2.9, author: WordPress-Team (latest version: 3.0), Automatische Aktualisierungen deaktiviert
Twenty Fourteen: version: 3.1, author: WordPress-Team (latest version: 3.2), Automatische Aktualisierungen deaktiviert
Twenty Nineteen: version: 2.0, author: WordPress-Team (latest version: 2.1), Automatische Aktualisierungen deaktiviert
Twenty Seventeen: version: 2.7, author: WordPress-Team (latest version: 2.8), Automatische Aktualisierungen deaktiviert
Twenty Sixteen: version: 2.4, author: WordPress-Team (latest version: 2.5), Automatische Aktualisierungen deaktiviert
Twenty Ten: version: 3.3, author: WordPress-Team (latest version: 3.4), Automatische Aktualisierungen deaktiviert
Twenty Thirteen: version: 3.3, author: WordPress-Team (latest version: 3.4), Automatische Aktualisierungen deaktiviert
Twenty Twelve: version: 3.3, author: WordPress-Team (latest version: 3.4), Automatische Aktualisierungen deaktiviert
Twenty Twenty: version: 1.7, author: WordPress-Team (latest version: 1.8), Automatische Aktualisierungen deaktiviert
Twenty Twenty-One: version: 1.3, author: WordPress-Team (latest version: 1.4), Automatische Aktualisierungen deaktiviert
Willer: version: 1.2.4, author: Denis Franchi, Automatische Aktualisierungen deaktiviert

### wp-plugins-active (10) ###

Admin Columns: version: 4.3.2, author: AdminColumns.com, Automatische Aktualisierungen deaktiviert
Akismet Anti-Spam: version: 4.1.10, author: Automattic, Automatische Aktualisierungen deaktiviert
Ext_REST_Media_Lib: version: 0.0.14, author: Martin von Berg, Automatische Aktualisierungen deaktiviert
Fotorama_Multi: version: 0.3.3, author: Martin von Berg, Automatische Aktualisierungen deaktiviert
gtb-recent-post-slider: version: 0.0.1, author: Martin von Berg, Automatische Aktualisierungen deaktiviert
Query Monitor: version: 3.7.1, author: John Blackbourn, Automatische Aktualisierungen deaktiviert
wp-front-albums: version: 0.3.0, author: Martin von Berg, Automatische Aktualisierungen deaktiviert
wp-special-functions: version: 0.0.13, author: Martin von Berg, Automatische Aktualisierungen deaktiviert
wp_post_map_view_simple: version: 0.8.0, author: Martin von Berg, Automatische Aktualisierungen deaktiviert
Yoast SEO: version: 16.7, author: Team Yoast, Automatische Aktualisierungen deaktiviert

### wp-media ###

image_editor: WP_Image_Editor_GD
imagick_module_version: Nicht verfügbar
imagemagick_version: Nicht verfügbar
imagick_version: Nicht verfügbar
file_uploads: File uploads is turned off
post_max_size: 40M
upload_max_filesize: 40M
max_effective_size: 40 MB
max_file_uploads: 20
gd_version: bundled (2.1.0 compatible)
gd_formats: GIF, JPEG, PNG, WebP, BMP, XPM
ghostscript_version: not available

### wp-server ###

server_architecture: Windows NT 10.0 AMD64
httpd_software: Apache
php_version: 7.3.6 64bit
php_sapi: apache2handler
max_input_variables: 1000
time_limit: 120
memory_limit: 128M
admin_memory_limit: 256M
max_input_time: 300
upload_max_filesize: 40M
php_post_max_size: 40M
curl_version: 7.64.0 OpenSSL/1.1.1c
suhosin: false
imagick_availability: false
pretty_permalinks: true
htaccess_extra_rules: false

### wp-database ###

extension: mysqli
server_version: 8.0.16
client_version: mysqlnd 5.0.12-dev - 20150407 - $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $

### wp-constants ###

WP_HOME: http://127.0.0.1/wordpress
WP_SITEURL: http://127.0.0.1/wordpress
WP_CONTENT_DIR: C:\Bitnami\wordpress-5.2.2-0\apps\wordpress\htdocs/wp-content
WP_PLUGIN_DIR: C:\Bitnami\wordpress-5.2.2-0\apps\wordpress\htdocs/wp-content/plugins
WP_MEMORY_LIMIT: 40M
WP_MAX_MEMORY_LIMIT: 256M
WP_DEBUG: true
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: true
SCRIPT_DEBUG: true
WP_CACHE: false
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_LOCAL_DEV: true
DB_CHARSET: utf8
DB_COLLATE: undefined

### wp-filesystem ###

wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable

`

#8 @martinvonberg
3 years ago

Tested now with PHP 8.0.1 and GD:
It works! So, I suppose it is an issue of imagick in combination with lossy / losless.

But: I used imagick during the tests and preparation for WebP with V5.8-RC4. Yet, after the update to V5.8 it did not work with the same server settings and therefore imagick.
Martin

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


3 years ago

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


3 years ago

#11 @antpb
3 years ago

  • Milestone changed from Awaiting Review to 5.8.1

#12 @antpb
3 years ago

  • Keywords reporter-feedback removed

#13 @desrosj
3 years ago

  • Keywords needs-testing added; needs-patch removed
  • Milestone changed from 5.8.1 to 5.8.2

This seems like it may have been an issue with how ImageMagick was configured. @alanjacobmathew are you able to share what the configuration was for ImageMagick/GD on the server you used for testing?

#14 @desrosj
3 years ago

This also could potentially be a duplicate of #53665.

@martinvonberg can you clarify what the file sizes are they you were experiencing the issue with? And if the sizes are large (over 2500 pixels), try smaller images to see if you're able to reproduce.

When testing if the images are larger, also check that the -scaled image generated is actually a .webp format and the sub sizes match the original format.

@alanjacobmathew's images are definitely larger, so that gave me the idea that this may be the same issue.

Last edited 3 years ago by desrosj (previous) (diff)

#15 @alanjacobmathew
3 years ago

@desrosj

Media Handling from site health

Active editor WP_Image_Editor_Imagick
ImageMagick version number 1690
ImageMagick version string ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
Imagick version 3.5.1
File uploads Enabled
Max size of post data allowed 60M
Max size of an uploaded file 60M
Max effective file size 60 MB
Max number of files allowed 20
Imagick Resource Limits
area: 122 MB
disk: 1073741824
file: 768
map: 512 MB
memory: 256 MB
thread: 1
ImageMagick supported file formats Unable to determine
GD version 2.3.0
GD supported file formats GIF, JPEG, PNG, WebP, BMP, XPM
Ghostscript version Unable to determine if Ghostscript is installed

I was able to reproduce it with this https://unsplash.com/photos/FV3GConVSss. Below are the observations.

640 by 427 pixels: not converted to webp
3762 by 2508 pixels: converted to webp. Dimensions 2560 by 1707 (big image threshold)

#16 @martinvonberg
3 years ago

@desrosj
Media Handling from site health:

image_editor: WP_Image_Editor_Imagick
imagick_module_version: 1673
imagemagick_version: ImageMagick 6.8.9-9 Q16 x86_64 2019-12-29 http://www.imagemagick.org
imagick_version: 3.4.3
file_uploads: File uploads is turned off
post_max_size: 96M
upload_max_filesize: 64M
max_effective_size: 64 MB
max_file_uploads: 20
imagick_limits:

imagick::RESOURCETYPE_AREA: 96 GB
imagick::RESOURCETYPE_DISK: -1
imagick::RESOURCETYPE_FILE: 6144
imagick::RESOURCETYPE_MAP: 96 GB
imagick::RESOURCETYPE_MEMORY: 48 GB
imagick::RESOURCETYPE_THREAD: 1

imagemagick_file_formats: 3FR, AAI, AI, ART, ARW, AVI, AVS, BGR, BGRA, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FITS, FRACTAL, FTS, G3, GIF, GIF87, GRADIENT, GRAY, GROUP4, GV, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, ICB, ICO, ICON, INFO, INLINE, IPL, ISOBRL, JBG, JBIG, JNG, JNX, JPEG, JPG, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MEF, MIFF, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV
gd_version: bundled (2.1.0 compatible)
gd_formats: GIF, JPEG, PNG, WebP, BMP, XPM
ghostscript_version: 9.26


image_filter in functions.php: active

First trial with PHP8.0 and : all jpgs converted to webp
Second trial with PHP 7.4.3 and Media-Handling as above shown: no conversion at all!

images: 4 jpgs
sizes:
4032 x 3024
3000 x 2000
1152 x 768
2560 x 1672

#17 @desrosj
3 years ago

  • Keywords needs-testing removed
  • Milestone 5.8.2 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Thanks everyone for the information! I've reread everything, and it definitely looks like these are configuration problems.

@martinvonberg If you look at the imagemagick_file_formats in the wp-media section, you'll notice that WEBP is not included in the list. In the Site Health info you copied where GD is used, you'll notice that WebP is included. You'll want to reach out to your hosting provider and ask that they compile ImageMagick with WebP support.

I'm still not definitively sure what's going on with @alanjacobmathew's situation, but I am pretty sure it is a mix of @martinvonberg's problem and #53665. If you're able to debug this further and find out that this is not the case, feel free to reopen with more information.

For those reasons, I am going to close this one out as worksforme.

Note: See TracTickets for help on using tickets.