Hi @toad78
This is Ioanna from Imagify, and I’ll gladly assist you here!
There are a few reasons why WebP will not be displayed using picture tags:
– background images added via CSS
– there is no WebP generated
– page element HTML is loaded after Imagify looks for the source code to apply WebP markup
– images are external
Background images, unfortunately, cannot be displayed in WebP when using picture tags. The solution, in this case, is to use rewrite rules way unless you are using Cloudflare/ CDN.
Regarding rewrite rules, note that as you are on NGINX you have to apply the rules manually to nginx.config file as Imagify is not able to add them automatically. Code to apply is:
location ~* ^(/.+)\.(jpg|jpeg|jpe|png|gif)$ {
add_header Vary Accept;
if ($http_accept ~* "webp"){
set $imwebp A;
}
if (-f $request_filename.webp) {
set $imwebp "${imwebp}B";
}
if ($imwebp = AB) {
rewrite ^(.*) $1.webp;
}
}
You can see more information on the following page https://imagify.io/documentation/my-images-are-broken/
Let me know if you need further assistance. I’ll be happy to help.
Best regards,
Ioanna