Avif images not getting picked by up Google Pagespeed

Possible stupid question but I have a site on a staging server and when tested with Google Pagespeed, its doesn’t register that I’m using Avif images.

When I view the image I can see that they have avif appended to the image, homepage-hero-2000x-q90.avif

When I open the image and try to save it, it downloads/saves as a jpeg.

When I do the same process locally, I’m able to save the image as a avif file.

I’m stumped, and possibly missing something really simple.

Thanks

Which thumb driver are you using? And which Kirby version?

Hey thanks for your response.

The thumb driver is IM, Kirby version is 3.8.2.

if you are using apache maybe the header is not set see .htaccess file

Hey thanks for your reply.

I added that to my .htaccess file, but it didnt seem to fix the issue.

Ive raised a ticket with my host.

Imagemagick is also enabled on my PHP options

ImageMagick is not a PHP option, not to be confused with PHP imagick extension.

Sorry by option I meant extension. So you’re saying ImageMagick or IM is not to be confused with the PHP imagick extension. From what Ive read the Imagick native PHP extension uses the ImageMagick API, surely it does the same thing?

Kirby uses the ImageMagick binary via an exec() command. If the PHP imagick extension is installed, this won’t help you. So you need to have ImageMagick installed on your server.

Ok sure, thanks for clearing that up for me. I will ask the server techs to install ImageMagick for me.

Thanks again, hopefully this fixes the issue :crossed_fingers:

Hi again,

When you say “you need to have ImageMagick installed on your server”, is this usually installed on VPS hosting?

Ive only generally used shared PHP hosting for Wordpress given the nature and size of projects I work on.

I asked tech support on the web host I generally use and their response was:

"It’s quite unusual that the software invokes a standalone binary from an exec() function, instead of using the official extension integrated into PHP.

There won’t be a way to install the imagick binary package on the shared cPanel Hosting servers, you would need a VPS to have your own isolated environment you can install those in."

I think you’ve answered my question here - AVIF Image generator BIN? - #8 by texnixe

Thanks again for your help!

Just as addendum: In Kirby 3.9.3 we updated the SimpleImage dependency to the latest version, which now supports AVIF. So if you update to 3.9.3 and then use the standard gd driver, AVIF will work.

Ok great. Ive tested locally and I can see in the Network tab all the images are avif which is great.

For the server settings on a shared PHP host, do I need to enable the GD extension?

It’s usually enabled, but better double-check.

So Ive checked and its enabled, even did a GD PHP dump and Avif support is true.

But I note in another post you said “Even if turned on by your provider, it still wouldn’t work because it is not supported by SimpleImage, the library used by Kirby’s GD driver”

Maybe I’m better off just using Webp as standard, the only thing for me is that when using the standard GD driver and webp, it compresses the .webp images so that they are almost unusable and this is with ‘quality’ => 90, in my config file.

As I wrote, the new version of SimpleImage present in Kirby 3.9.3 supports AVIF

Yes I get that, it works locally for me but when testing on a shared server, Kirby 3.9.3, PHP 8.1 with GD enabled and WebP support, Avif support true, its still loading the ‘avif’ images as jpg.

Ive cleared my cache etc

I dont mean to be difficult, so my apologies. Would love to get this, webp, avif image formats working on shared PHP hosting as that’s mostly what my clients have budgets for.

Then the only thing I can think of is that the version of GD on the server does not support it.

Hmm ok, for info the server is running GD Version 2.3.3

According to the changelog, AVIF support was added in 2.3.2, so you should be fine. Have you removed the im driver from your config?