WordPress version 6.5 will start supporting AVIF format images

WordPress 6.5 Starting with this release, a new image format called AVIF will be supported, which is not only high quality, but also has a much smaller file size than older formats such as JPEG or PNG, which can be halved in size while maintaining the same sharpness. AVIF images also show more color and look clearer, especially in areas where the image has a lot of detail.

图片[1]-WordPress 6.5 版本将开始支持 AVIF 格式的图片-光子波动网 | WordPress教程、Elementor教程与故障修复

Starting from WordPress version 6.5, you will be able to upload and use AVIF images just like JPEGs or PNGs, as long as your web hosting supports AVIF. Switching to AVIF format images will make your website run faster and give your visitors a better experience.

Benefits of AVIF images

Images in the AVIF format are much smaller than JPEGs, which means pages load faster and use less web traffic. With AVIF images, you can still enjoy all the image optimization features that WordPress offers, such as automatic image resizing, priority loading, and lazy loading. Also, most major browsers now support the AVIF format, so most websites can start using it.

Creating AVIF images

Many image editing programs now let you save images in AVIF format. You can also use command line tools or online tools like Squoosh to convert images. Once you've converted an image to AVIF format, you can upload it and use it in WordPress just like any other type of image. wordPress can even automatically process AVIF images for you, check out the FAQ section below for more details.

Using AVIF images in WordPress is easy.

Using AVIF Images in WordPress

In WordPress, AVIF-formatted images are pretty much like any other type of image, but there are a few key points to keep in mind:

  1. AVIF image support in WordPress depends on whether your web server supports certain image processing libraries (such as Imagick and LibGD). You can check if AVIF format is supported in WordPress by going to the backend of WordPress, under Tools -> Site Status, clicking on the Info tab, and then looking at the " Media Processing" section to check if AVIF format is supported.
  2. If many of your site visitors use browsers that don't support AVIF, you may want to consider not using AVIF-formatted images for a while, or adding some extra code (called a polyfill script) to solve the problem.

frequently asked questions

How do I adjust the compression level of the resulting AVIF image?

wp_editor_set_quality This filter allows you to adjust the quality settings of your images. You can set a specific quality based on different file types, such as JPEG or PNG.

// Use a quality setting of 75 for AVIF images.
function filter_avif_quality( $quality, $mime_type ) {
if ( 'image/avif' === $mime_type ) {
return 75;
}
return $quality;
}
add_filter( 'wp_editor_set_quality', 'filter_avif_quality', 10, 2 );

How to output lossless AVIF image?

If you set the compression level to 100, then AVIF images are saved in lossless mode, meaning that the quality of the image is not degraded.

Can WordPress create AVIF images when I upload JPEGs?

Right. Developers can use the image_editor_output_format This filter sets the image format conversion on upload. Here is an example:

// Output AVIFs for uploaded JPEGs
function filter_image_editor_output_format( $formats ) {
$formats['image/jpg'] = 'image/avif'; return $formats; { $formats['image/jpg'] = 'image/avif'
return $formats;
}
add_filter( 'image_editor_output_format', 'filter_image_editor_output_format' );

If I'm using WordPress multisite, can I use AVIF images on all my sites?

For multisite setups, WordPress allows control over the types of files users can upload. We are working on improving this in #53167. In the meantime, you can make sure that all sites in your network support AVIF files by using a special plugin called 'mu-plugins' (mandatory plugin). You only need to use the site_option filter to add AVIF as an allowed file type for all sites:

// Ensure all network sites include AVIF support.
function filter_site_option_upload_filetypes( $filetypes ) {
$filetypes = explode( ' ', $filetypes ); if ( !
if ( ! in_array( 'avif', $filetypes, true ) ) {
$filetypes[] = 'avif';
}
return implode( ' ', $filetypes );
}
add_filter( 'site_option_upload_filetypes', 'filter_site_option_upload_filetypes' ); }

Contact Us
Can't read the tutorial? Contact us for a free answer! Free help for personal, small business sites!
客服微信
Customer Service
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: [email protected]
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
This article was written by Harry
THE END
If you like it, support it.
kudos0 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments