Make WordPress Core

Opened 5 months ago

Last modified 3 weeks ago

#61167 assigned defect (bug)

AVIF image thumbnail not created !

Reported by: joomskys's profile joomskys Owned by: adamsilverstein's profile adamsilverstein
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.5
Component: Media Keywords: avif image thumbnail good-first-bug
Focuses: performance Cc:

Description

Thank you all the team for this great feature.
i have issue when i try to use AVIF image, can you help?
the issue is:

i have AVIF image file,
i uploaded it to wordpress via Media Upload -> https://prnt.sc/54s8JQoSWgfl
image upload completed -> https://prnt.sc/QZmqQiCD-R63
BUT the image thumbnail size like : thumbnail, medium, large, … NOT CREATED ! -> https://prnt.sc/A54F2cFUsHBH
can you look and help ?
am using siteground web hosting!
Thanks

Attachments (5)

Julie Gold Earrings.avif (8.4 KB) - added by joomskys 5 months ago.
error-uploading-in-media-library.jpg (154.8 KB) - added by adamsilverstein 5 months ago.
server-lacks-avif-support.jpg (224.0 KB) - added by adamsilverstein 5 months ago.
AVIF-upload-test.jpg (1.4 MB) - added by adamsilverstein 5 months ago.
Monosnap Edit Post “test avif” ‹ My... Website — WordPress 2024-05-08 12-46-02.jpg (46.9 KB) - added by adamsilverstein 5 months ago.

Download all attachments as: .zip

Change History (18)

This ticket was mentioned in Slack in #core-performance by spacedmonkey. View the logs.


5 months ago

#2 follow-ups: @adamsilverstein
5 months ago

  • Owner set to adamsilverstein
  • Status changed from new to assigned

Hey @joomskys - thanks for the bug report and sample image.

I gave your image a test on my server that has AVIF support enabled and the srcset entries were created, which means it is likely your server lacks AVIF support.

Can you check to see if your media handling includes AVIF? Look under Tools->Site Health->Info->Media and check which media editor and formats are supported (search for "AVIF").

I tested again on a site that lacks AVIF support and got the behavior you described - I was able to upload the image, but no subsizes were created.

Interestingly, when I tried uploading the AVIF file in the Media library, I got an error message "This image cannot be processed by the web server. Convert it to JPEG or PNG before uploading." and the image refuxed to upload. So this does feel like a bug to me, the behavior should be consistent - the bug is likely on the Gutenberg (rather than core) side though - the editor should reject your AVIF file when you try to upload it on a site that lacks AVIF support.

am using siteground web hosting!

Great, you can ask them about enabling AVIF for your site! It may be available only on certain plans or they may need to hear requests from enough customers wanting it to add support.

Last edited 5 months ago by adamsilverstein (previous) (diff)

#3 @adamsilverstein
5 months ago

the bug is likely on the Gutenberg (rather than core) side though - the editor should reject your AVIF file when you try to upload it on a site that lacks AVIF support.

Correction: looks like we bootstrap the available mime types from the WordPress side. We should be able to address this in core.

This ticket was mentioned in PR #6531 on WordPress/wordpress-develop by @adamsilverstein.


5 months ago
#4

  • Keywords has-patch added

#5 @adamsilverstein
5 months ago

  • Keywords has-patch removed

I created this PR which should disable AVIF uploading on sites where AVIF isn't supported by the server.

Testing in Gutenberg, after this patch I get a warning message on my server that does not support AVIF and I cannot upload the test image.

I expanded the check to include WebP since a small percentage of servers still don't support that format. Checking every format seems excessive.

Last edited 5 months ago by adamsilverstein (previous) (diff)

@adamsilverstein commented on PR #6531:


5 months ago
#6

## Testing instructions

  • Use the WordPress playground build above
  • Try uploading an AVIF image (see the Trac ticket for a sample image)

#7 @adamsilverstein
5 months ago

  • Component changed from Upload to Media
  • Keywords dev-feedback reporter-feedback added

#8 in reply to: ↑ 2 @azaozz
5 months ago

Replying to adamsilverstein:

I got an error message "This image cannot be processed by the web server. Convert it to JPEG or PNG before uploading." and the image refuxed to upload.

Yea this is a bug and needs fixing. Most likely it's a "left over" from the initial implementation of error messages about AVIF files few years ago when they weren't supported in the web browsers.

Looking at https://github.com/WordPress/wordpress-develop/pull/6531: thinking it would be better to show a better error message that explains exactly what's wrong (server not able to work with these images) and tell the users to convert the file before uploading it. Perhaps the same text as in the JS error?

Or maybe implement that error in JS in Gutenberg, and keep the change to allowedMimeTypes in case an unsupported image is uploaded by other means.

Last edited 5 months ago by azaozz (previous) (diff)

#9 in reply to: ↑ 2 @joomskys
5 months ago

Replying to adamsilverstein:

Thank for your watching,
i will contact and request support from my hosting provider!

Best Regard

Last edited 5 months ago by joomskys (previous) (diff)

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


3 months ago

#11 @adamsilverstein
6 weeks ago

  • Focuses performance added
  • Keywords good-first-bug added; dev-feedback reporter-feedback removed

#12 @adamsilverstein
3 weeks ago

Looking at https://github.com/WordPress/wordpress-develop/pull/6531: thinking it would be better to show a better error message that explains exactly what's wrong (server not able to work with these images) and tell the users to convert the file before uploading it. Perhaps the same text as in the JS error?

@azaozz in the PR I'm aiming to alter allowedMimeTypes so that it actually reflects the supported types. This means an error will be shown when trying to upload an AVIF image if the server doesn't have AVIF support. Currently, users don't get any error - the image uploads, but no sub-sized images are created (leading to this bug report).

Is your suggestion that we make this change and ALSO update the error message string?

#13 @adamsilverstein
3 weeks ago

Note we have this related ticket about updating the error message - https://core.trac.wordpress.org/ticket/61361

Note: See TracTickets for help on using tickets.