{"id":272508,"date":"2026-01-13T13:49:59","date_gmt":"2026-01-13T13:49:59","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/images-to-avif\/"},"modified":"2026-03-16T10:18:12","modified_gmt":"2026-03-16T10:18:12","slug":"images-to-avif","status":"publish","type":"plugin","link":"https:\/\/cn.wordpress.org\/plugins\/images-to-avif\/","author":9548563,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"2.0","stable_tag":"2.0","tested":"6.9.4","requires":"5.0","requires_php":"7.0","requires_plugins":null,"header_name":"Images to AVIF","header_author":"KubiQ","header_description":"Convert JPG, PNG, GIF and WEBP images to AVIF and speed up your web","assets_banners_color":"cabb8b","last_updated":"2026-03-16 10:18:12","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/www.paypal.me\/jakubnovaksl","header_plugin_uri":"https:\/\/www.paypal.me\/jakubnovaksl","header_author_uri":"https:\/\/kubiq.sk","rating":0,"author_block_rating":0,"active_installs":60,"downloads":469,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0":{"tag":"1.0","author":"kubiq","date":"2026-01-13 13:49:44"},"1.1":{"tag":"1.1","author":"kubiq","date":"2026-01-14 09:23:14"},"2.0":{"tag":"2.0","author":"kubiq","date":"2026-03-16 10:18:12"}},"upgrade_notice":[],"ratings":[],"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":3438659,"resolution":"128x128","location":"assets","locale":""},"icon-256x256.png":{"filename":"icon-256x256.png","revision":3438659,"resolution":"256x256","location":"assets","locale":""}},"assets_banners":{"banner-772x250.png":{"filename":"banner-772x250.png","revision":3438659,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0","1.1","2.0"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":3438659,"resolution":"1","location":"assets","locale":""},"screenshot-2.png":{"filename":"screenshot-2.png","revision":3438659,"resolution":"2","location":"assets","locale":""},"screenshot-3.png":{"filename":"screenshot-3.png","revision":3438659,"resolution":"3","location":"assets","locale":""}},"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[4154,84,1452,214],"plugin_category":[50,52],"plugin_contributors":[81042],"plugin_business_model":[],"class_list":["post-272508","plugin","type-plugin","status-publish","hentry","plugin_tags-convert","plugin_tags-media","plugin_tags-optimize","plugin_tags-pictures","plugin_category-media","plugin_category-performance","plugin_contributors-kubiq","plugin_committers-kubiq"],"banners":{"banner":"https:\/\/ps.w.org\/images-to-avif\/assets\/banner-772x250.png?rev=3438659","banner_2x":false,"banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/images-to-avif\/assets\/icon-128x128.png?rev=3438659","icon_2x":"https:\/\/ps.w.org\/images-to-avif\/assets\/icon-256x256.png?rev=3438659","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/images-to-avif\/assets\/screenshot-1.png?rev=3438659","caption":""},{"src":"https:\/\/ps.w.org\/images-to-avif\/assets\/screenshot-2.png?rev=3438659","caption":""},{"src":"https:\/\/ps.w.org\/images-to-avif\/assets\/screenshot-3.png?rev=3438659","caption":""}],"raw_content":"<!--section=description-->\n<p>Statistics say that AVIF format can save more than a half of the page weight without losing images quality.\nConvert PNG, JPG, GIF and WEBP images to AVIF and speed up your web, save visitors download data, make your Google ranking better.\nInstall also Images to WebP plugin if you want to have fallback to WebP and then to the original file.<\/p>\n\n<ul>\n    <li><strong>automated test after plugin activation to make sure it will work on your server<\/strong><\/li>\n    <li><strong>works with all types of WordPress installations: domain, subdomain, subdirectory, multisite\/network<\/strong><\/li>\n    <li><strong>works on Apache and NGiNX<\/strong><\/li>\n    <li><strong>image URL will be not changed<\/strong> so it works everywhere, in &lt;img&gt; src, srcset, &lt;picture&gt;, even in CSS backgrounds and there is no problem with cache<\/li>\n    <li><strong>original files will be not touched<\/strong><\/li>\n    <li>set quality of converted images<\/li>\n    <li>auto convert on upload<\/li>\n    <li>only convert image if AVIF filesize is lower than original image filesize<\/li>\n    <li>bulk convert existing images to AVIF ( you can choose folders )<\/li>\n    <li>bulk convert only missing images<\/li>\n<\/ul>\n\n<h3>Hooks for developers<\/h3>\n\n<h4>images_to_avif_sizes<\/h4>\n\n<p>Maybe you want to disable AVIF for thumbnails<\/p>\n\n<pre><code>add_filter( 'images_to_avif_sizes', 'disable_images_to_avif_sizes', 10, 2 );\nfunction disable_images_to_avif_sizes( $sizes, $attachmentId ){\n    unset( $sizes['thumbnail'] );\n    return $sizes;\n}\n<\/code><\/pre>\n\n<h4>images_to_avif_htaccess<\/h4>\n\n<p>Maybe you want to modify htaccess rules somehow<\/p>\n\n<pre><code>add_filter( 'images_to_avif_htaccess', 'modify_images_to_avif_htaccess', 10, 2 );\nfunction modify_images_to_avif_htaccess( $rewrite_rules ){\n    \/\/ do some magic here\n    return $rewrite_rules;\n}\n<\/code><\/pre>\n\n<h4>images_to_avif_abspath<\/h4>\n\n<p>Maybe you use roots.io\/bedrock or other custom folder structure<\/p>\n\n<pre><code>add_filter( 'images_to_avif_abspath', 'modify_images_to_avif_abspath', 10, 2 );\nfunction modify_images_to_avif_abspath( $abspath ){\n    return trailingslashit( WP_CONTENT_DIR );\n}\n<\/code><\/pre>\n\n<h4>$images_to_avif-&gt;convert_image()<\/h4>\n\n<p>Maybe you want to automatically generate AVIF for other plugins<\/p>\n\n<pre><code>add_action( 'XXPLUGIN_image_created', 'XX_images_to_avif', 10, 2 );\nfunction XX_images_to_avif( $image_path ){\n    global $images_to_avif;\n    $images_to_avif-&gt;convert_image( $image_path );\n}\n<\/code><\/pre>\n\n<!--section=installation-->\n<ol>\n<li>Upload <code>images-to-avif<\/code> directory to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id=\"plugin%20requirements\"><h3>Plugin requirements<\/h3><\/dt>\n<dd><p>It should work almost everywhere ;)\nPHP 5.6 or higher\nGD or Imagick extension with AVIF support\nEnabled server modules: <code>mod_mime<\/code>, <code>mod_rewrite<\/code><\/p><\/dd>\n<dt id=\"avif%20images%20stored%20location\"><h3>AVIF images stored location<\/h3><\/dt>\n<dd><p>AVIF images are generated in same directory as original image. Example:\noriginal img: <code>\/wp-content\/uploads\/2019\/11\/car.png<\/code>\navif version: <code>\/wp-content\/uploads\/2019\/11\/car.png.avif<\/code><\/p><\/dd>\n<dt id=\"how%20to%20get%20original%20image%20from%20the%20browser%3F\"><h3>How to get original image from the browser?<\/h3><\/dt>\n<dd><p>Just add <code>?no_avif=1<\/code> to the URL and original JPG\/PNG will be loaded<\/p><\/dd>\n<dt id=\"how%20to%20check%20if%20plugin%20works%3F\"><h3>How to check if plugin works?<\/h3><\/dt>\n<dd><p>When you have installed plugin and converted all images, follow these steps:<\/p>\n\n<ol>\n<li>Run <code>Google Chrome<\/code> and enable <code>Dev Tools<\/code> (F12).<\/li>\n<li>Go to the <code>Network<\/code> tab click on <code>Disable cache<\/code> and select filtering for <code>Img<\/code> <em>(Images)<\/em>.<\/li>\n<li>Refresh your website page.<\/li>\n<li>Check list of loaded images. Note <code>Type<\/code> column.<\/li>\n<li>If value of <code>avif<\/code> is there, then everything works fine.<\/li>\n<\/ol><\/dd>\n<dt id=\"nginx%20and%20apache%20together\"><h3>NGiNX and Apache together<\/h3><\/dt>\n<dd><p>If you have some proxy setup or some other combination of NGiNX and Apache on your server, then probably .htaccess changes won't work and you will need to ask your hosting provider to disable NGiNX direct processing of image static files.<\/p><\/dd>\n<dt id=\"apache%20.htaccess\"><h3>Apache .htaccess<\/h3><\/dt>\n<dd><p>Plugin should automatically update your .htaccess with needed rules.\nIn case it's not possible to write them automatically, screen with instructions will appear.\nAnyway, here is how it should look like:<\/p>\n\n<pre><code>&lt;IfModule mod_mime.c&gt;\n    AddType image\/avif .avif\n&lt;\/IfModule&gt;\n\n&lt;IfModule mod_rewrite.c&gt;\n    RewriteEngine On\n    RewriteCond %{HTTP_ACCEPT} image\/avif\n    RewriteCond %{REQUEST_FILENAME} \"\/\"\n    RewriteCond %{REQUEST_FILENAME} \"\\.(jpg|jpeg|png|gif|webp)$\"\n    RewriteCond %{REQUEST_FILENAME}\\.avif -f\n    RewriteCond %{QUERY_STRING} !no_avif\n    RewriteRule ^(.+)$ $1\\.avif [NC,T=image\/avif,E=avif,L]\n&lt;\/IfModule&gt;\n<\/code><\/pre><\/dd>\n<dt id=\"nginx%20config\"><h3>NGiNX config<\/h3><\/dt>\n<dd><p>After you activate plugin, screen with instructions will appear.\nAnyway, here is how it should look like:<\/p>\n\n<p>You need to add this map directive to your http config, usually nginx.conf ( inside of the http{} section ):<\/p>\n\n<pre><code>map $arg_no_avif $no_avif{\n    default \"\";\n    \"1\" \"no_avif\";\n}\n\nmap $http_accept $avif_suffix{\n    default \"\";\n    \"~*avif\" \".avif\";\n}\n<\/code><\/pre>\n\n<p>or without <code>map<\/code> directive:<\/p>\n\n<pre><code>if ( $http_accept ~ \"image\/avif\" ) {\n    set $avif .avif ;\n}\n\nlocation ~* (.*)\\.(?:png|jpe?g|gif|webp)$ {\n    if ( -f $document_root$1.avif ) {\n            set $avif serve$avif ;\n    }\n    if ( $avif = \"serve.avif\" ) {\n        return 301 '$1.avif';\n    }\n}\n<\/code><\/pre>\n\n<p>then you need to add this to your server block, usually site.conf or \/nginx\/sites-enabled\/default ( inside of the server{} section ):<\/p>\n\n<pre><code>location ~* ^\/.+\\.(png|gif|webp|jpe?g)$ {\n    add_header Vary Accept;\n    try_files $uri$avif_suffix$no_avif $uri =404;\n}\n<\/code><\/pre><\/dd>\n<dt id=\"isp%20manager\"><h3>ISP Manager<\/h3><\/dt>\n<dd><p>Are you using ISP Manager? Then it's probably not working for you, but no worries, you just need to go to <code>WWW domains<\/code> and delete <code>jpg|jpeg|png<\/code> from the <code>Static content extensions<\/code> field.<\/p><\/dd>\n<dt id=\"delete%20all%20generated%20avif%20images\"><h3>Delete all generated AVIF images<\/h3><\/dt>\n<dd><p>There is no button to do that and it will also not delete generated AVIFs automatically when you deactivate the plugin, but if you really need this, you can run some shell command to achieve this:<\/p>\n\n<pre><code>find . -type f -name \"*.avif\" -exec bash -c 'if [ -f \"${1%.avif}\" ]; then echo \"Deleting $1\"; rm \"$1\"; fi' _ {} \\;\n<\/code><\/pre>\n\n<p>This will find all the files with a <code>.avif<\/code> extension and if there is similar file with the exact filename, but without the <code>.avif<\/code> extension, then it will delete it.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>2.0<\/h4>\n\n<ul>\n<li>now images are optimized in the background instead of during upload which was slowing down the workflow<\/li>\n<li>fix a few small things based on the current Plugin Check results<\/li>\n<\/ul>\n\n<h4>1.1<\/h4>\n\n<ul>\n<li>optimize old images convert process<\/li>\n<li>remove not working images_to_avif_extensions filter<\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>First version<\/li>\n<\/ul>","raw_excerpt":"Convert PNG, JPG, GIF and WEBP images to AVIF and speed up your web loading","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/272508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=272508"}],"author":[{"embeddable":true,"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/kubiq"}],"wp:attachment":[{"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=272508"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=272508"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=272508"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=272508"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=272508"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=272508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}