Avif images not getting picked by up Google Pagespeed

Yes this is what i have on my staging server

// image settings
    'thumbs' => [
        'quality'   => 90,
        'srcsets' => [
            'default' => [
                '300w'  => ['width' => 300],
                '600w'  => ['width' => 600],
                '800w'  => ['width' => 800],
                '1200w'  => ['width' => 1200],
                '2000w' => ['width' => 2000]
            ],
            'avif' => [
                '600w'  => ['width' => 600, 'quality' => 70, 'format' => 'avif'],
                '800w'  => ['width' => 800, 'quality' => 70, 'format' => 'avif'],
                '1200w'  => ['width' => 1200, 'quality' => 70, 'format' => 'avif'],
                '2000w' => ['width' => 2000, 'quality' => 70, 'format' => 'avif'],
            ]
        ]
    ],

Ive run into another issue when running the default image driver, GD. All my images in the panel are blurry and when uploading say a new footer jpg to test, its really blurry

Panel

The original footer img of 2000px wide, 637kb is compressed to 5.8kb?

I’ve deleted the media library and refreshed.

I had this issue when testing locally, all my webp, jpg, png images were compressed to the max, this is honestly driving me crazy!

For what its worth, I rolled backed the Kirby version to 3.8.2, set thumbs to use default GD, used webp images throughout.

For my testing on shared PHP Apache servers, running the latest Kirby version 3.9, PHP 8.1, Avif doesnt work with the Default thumbs library of GD.

If using webp and the latest Kirby version, the webp images were badly compressed…

All the above is just my experience and others no doubt will have different results, so please take it with a pinch of salt.

Cheers

the simple image lib will fail silently afaik in dumping the raw jpeg - thats what you see in the inspector. an avif extension but a jpeg mime detected.

enable debug mode, add a test.jpg to your /templates folder and this code to any template and try it manually.

$image = imagecreatefromjpeg(__DIR__ . '/test.jpg');  //read a jpg file
$i = imageavif($image, 'test.avif');  //save an avif file
var_dump($i);

Hi ya,

Ok, I’ve setup a copy of my existing site locally with the latest version of Kirby 3.9.3, PHP 8.1 etc.

The var dump, returns true. It also returns true for Kirby 3.8.2

As another side issue, for me, the latest version of Kirby compresses webp images much more than 3.8.2, 3.8.4, 3.9.3

Kirby 3.9.3
image-2000x.webp 37.96kb

Kirby 3.9.2
image-2000x.webp 240.67kb

Kirby 3.8.4
image-2000x.webp 240.67kb

Kirby 3.8.2
image-2000x.webp 240.67kb

looks to me like before 3.9.3 there is no compression. what is the size of the same image raw (jpg)?

that just means your local dev setup has avif support. nothing to do with kirby.

i would say it might fail on your production server.

Nope there’s compression.

As another example using Kirby 3.9.2, the starting jpeg was 586kb. It got compressed down to 296.25kb webp, so roughly 50%

With Kirby 3.9.3, again the starting image is 586kb, it was compressed down to 38.41kb webp, 6.5% of the original size

Yes you are right, it seems AVIF image support is disabled on the staging server.

Which is weird because when I’ve done a var dump on the Home page, <?php var_dump(gd_info()); ?> to check if GD is running, it says it supports webp, avif etc. GD Version 2.3.3, Webp Support => true, Avif Support => true.

Look I’m happy as webp seems to working fine, that should keep Google pagespeed happy. Although for me Kirby 3.9.3 compresses webp way too much!

VPS seems to be the way to go for AVIF support though.

Ok thanks for checking that. Based on the GD info dump, the server is running 2.3.3