WebP Images resolution not working in Gutenberg on wordpress.com | Modern Image Format
Bug Description
I recently moved hosts returning to wordpress.com. I've been using the Modern Image Formats plugin since release without issue.
However, since the site move whenever I upload a new image in the editor I get an error: "This image has an empty alt attribute; its file name is G0061259-1024x768.webp"
which is weird because the plugin re-names the file with -jpg- The block should be looking for G0061259-jpg-1024x768.webp or whatever image resolution was produced. The error occurs on all file resolution sizes except 'original' which displays correctly in the editor.
All images however display correctly on the front end.
Steps to reproduce
- Go to wordpress.com hosted blog
- Install the Modern Image Formats plugin
- Upload an image in the editor
- See error
Screenshots
Additional Context
WordPress 6.6.1 PHP 8.1 Gutenberg 19.0.0
Whatever the wordpress.com Business hosting plan standard Nginx plan setting are.
Existing files and pages pre move have no issues. Only new uploads.
Selecting 'Outputi JPEG images in addition to the modern format' solves the issue in the editor, webp images display on the front end. But this isn't too sustainable long term imo.
Aside: On WordPress.com there is an Image CDN which should automatically serve WebP for uploaded images.
Thanks for the bug report @tehjaymo... As @westonruter points out above, you may not need this plugin with wp.com already offering an image CDN with WebP support built in (but not AVIF afaik).
Still, I'm curious if I can reproduce, can you confirm what type of plan you are on?
Also, can you check Tools->Site Health->Info->Media and report back here what Editor/filetype support is listed?
Huh, thats weird. I've testes with the plugin turned of but CD turned on and it only seems to server resized jpgs. Anywhoos here's the info from my site health
| Active editor | Photon_Subsizes_WP_Image_Editor_GD |
|---|---|
| ImageMagick version number | Not available |
| ImageMagick version string | Not available |
| Imagick version | Not available |
| File uploads | Enabled |
| Max size of post data allowed | 2047M |
| Max size of an uploaded file | 2047M |
| Max effective file size | 2 GB |
| Max number of files allowed | 20 |
| GD version | bundled (2.1.0 compatible) |
| GD supported file formats | GIF, JPEG, PNG, WebP, BMP, AVIF |
| Ghostscript version | Not available |
@tehjaymo thanks for the details. Interesting to note that wp.com is using a custom Image Editor class - Photon_Subsizes_WP_Image_Editor_GD.
Aside: On WordPress.com there is an Image CDN which should automatically serve WebP for uploaded images.
Using the image CDN is probably the best advice on .com. although I don't think it supports AVIF?
Should we warn users here if we know the plugin won't work correctly?
I tried to test this out, unfortunately wordpress.com requires a paid account to install plugins.
I also verified Photon still doesn't support AVIF images, although the reasoning might be out of date. I commented on the closed ticket: https://github.com/Automattic/jetpack/issues/35432
I am closing this ticket as "wontfix" since wordpress.com is a closed platform and the source of Photon_Subsizes_WP_Image_Editor_GD is not available, we can't be sure why this doesn't work. Furthermore, images are served from an image CDN on wordpress.com (aka Photon) so this plugin shouldn't be required, instead I would encourage users to rely on Photon and work towards landing support for AVIF there.