Images are renamed .avif but no difference to size or dimensions

Well from a quick search you need atleast version 7.0.25 for Avif. Looks your installed version of ImageMagick is too old.

Okay, thanks. I’m going to give up on ImageMagick and use the default GD driver. From other posts on this forum I understand that the GD driver does not support AVIF?

Again it depends on the installed version of GD.

The GD extension in PHP 8.1 and later supports AVIF image format,

You need Kirby 3.9.3 at least, because SimpleImage (the software that is used for the GD driver), was updated only recently.

Brilliant, I’m on my way…

I’ve turned on PHP 81.
GD is turned on.
I’m using Kirby 3.9.3

Still not working!

Possibly, this happened to me. That can be changed on the PHP page in cPanel. There will be a list of disabled extensions there. you need to remove exec() from that list

I’ve found the PHP Selector page in cPanel, but ‘exec’ is not in the list. See below.

I’m assuming this is the wrong page. Any idea where in cPanel I can turn exec() on?

You need to click on the options tab at the top, just under the PHP icon. its in there.

exec() is only needed for the im driver, not for gd.

I’ve given up with ImageMagick, but it’s still not working.

I’ve turned on PHP 8.1
GD is turned on
I’m using Kirby 3.9.3

Here’s my code:

<?php

return [
	'debug'  => false,


	'thumbs' => [
		'srcsets' => [
			'default' => [
				'400w'  => ['width' => 400],
				'800w'  => ['width' => 800],
				'1200w'  => ['width' => 1200],
				'1600w'  => ['width' => 1600],
				'2112w' => ['width' => 2112],
				'3240w' => ['width' => 3240]
			],
			'avif' => [
				'400w'  => ['width' => 400, 'format' => 'avif'],
				'800w'  => ['width' => 800, 'format' => 'avif'],
				'1200w'  => ['width' => 1200, 'format' => 'avif'],
				'1600w'  => ['width' => 1600, 'format' => 'avif'],
				'2112w' => ['width' => 2112, 'format' => 'avif'],
				'3240w' => ['width' => 3240, 'format' => 'avif']
			],
			'webp' => [
				'400w'  => ['width' => 400, 'format' => 'webp'],
				'800w'  => ['width' => 800, 'format' => 'webp'],
				'1200w'  => ['width' => 1200, 'format' => 'webp'],
				'1600w'  => ['width' => 1600, 'format' => 'webp'],
				'2112w' => ['width' => 2112, 'format' => 'webp'],
				'3240w' => ['width' => 3240, 'format' => 'webp']
			]
		]
	]
];
<picture>
	<source
		srcset="<?= $file->srcset('avif') ?>"
		sizes="(max-width: 2112px) 100vw, 2112px"
		type="image/avif"
	>

	<source
		srcset="<?= $file->srcset('webp') ?>"
		sizes="(max-width: 2112px) 100vw, 2112px"
		type="image/webp"
	>
	
	<img
		alt="<?= $file->alt() ?>"
		class="<?= $file->border() ?>"
		src="<?= $file->url() ?>"
		srcset="<?= $file->srcset() ?>"
		sizes="(max-width: 2112px) 100vw, 2112px"
		width="<?= $file->width() ?>"
		height="<?= $file->height() ?>"
	>
</picture>

And a screen grab from Dev Tools. The images are being renamed with the thumb width and avif file ending, but the dimensions are not changing, the file size is not changing and actually the Dev Tools is saying the image is still a jpeg.

Screenshot 2023-05-07 at 2.06.11 pm

If it helps my website is

Please check phpinfo() for what image types are supported in your version of gd

This is my current local php 8.2 install which as you can see has AVIF supported:

If you don’t have any information about AVIF here or if its not enabled, you are out of luck and have to stick with webp for the moment.

Where are you hosting your site?

How do I do that?
I’ve typed phpinfo() into the Terminal in my cPanel but it doesn’t do anything.

My host is Fast & Simple Shared Web Hosting | Kualo the ‘solo’ package

phpinfo() is a php method. Use it in a template, for example

A thing that I find useful to do when I don’t know or understand something is to google it.

Urm, so in a Kirby template I write:

phpinfo()

and then when I open a page based on that template in a browser the page will display the PHP info, including the GD info?

I’ve tried this and it doesn’t work. The page displays, but there is no PHP info.

Here’s the last bit of my page template code:

	<footer>
		<div class="wrapper">
			<h2>Portfolio</h2>
			<?php snippet('portfolio-list-text') ?>
			<?php snippet('contact-details') ?>
		</div>
	</footer>

	<?= js('assets/scripts.js') ?>	
	phpinfo()
</body>
</html>

And I have been Googling, for about an hour. But to be honest it’s hard to find info when I don’t know what I’m searching for

Okay, trying to get avif images to work is proving too difficult. So I’ve fallen back to the GD driver and webp images. This all seems to work.

Thanks for your help texnixe and jimbobrjames

PHP code always has to go into php tags, otherwise it’s just treated as text.

A 10 second google search with “phpinfo in webpage” results in a list with this on 2nd place: How to Easily Create and Use a phpinfo Page (In 3 Steps)

I’ve never heard of a “phpinfo” or “phpinfo in webpage”. When Texnixe suggested I check “phpinfo()” I tried typing it into Terminal in my cPanel. You are assuming a lot knowledge, that I don’t have. If you don’t know what you’re looking for it’s hard to find.

Thanks for the link. Creating a new page (rather than using the code in an existing page template) works great.

Okay according to the PHP info my servers GD driver supports avif images. But yesterday they were not working. Yesterday I changed the PHP version on my server from 8 to 8.1. Is this an instant change, or does it take time to change? I’ll try again with avif image…

Still not working. The file name and extension is changed, but the dimensions and size has not.

For now I’m going to stick with webp images. I might revisit avif images at another time.

Thanks for all your help. It’s appreciated. I’m learning a lot!