Go to the blog AVIF has landed by Jake Archibald and download an AVIF image.
AVIF is a new image format derived from the keyframes of AV1 video. It's a royalty-free format, and it's already supported in Chrome 85 on desktop. Android support will be added soon, Firefox is working on an implementation, and although it took Safari 10 years to add WebP support, I don't think we'll see the same delay here, as Apple are a member of the group that created AV1.
The file should be uploaded
The media manager should be adjusted to allow uploading AVIF images.
Labels |
Added:
?
|
Joomla Administrator > Content > Media > Options
,avif,AVIF
avif
Tried to upload an AVIF image.
The result:
Concluding two things:
Title |
|
The MIME type is image/heif
.
Added MIME type image/heif
. Uploading an AVIF image is not possible with the same error message as mentioned earlier
Can you post a link to the image for testing?
I've been using one of the avif images downloaded from the article mentioned in the description of this issue
What happens if you switch off "Check MIME Types" in media manager options?
Yes, but I wanted to know what happens when the MIME type check is switched off.
It works without MIME check.
So the MIME check is the broken thing? Maybe it just can't handle that new format yet? Maybe our dependency needs an update for that?
The MIME type is determined in the MediaHelper class here:
https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Helper/MediaHelper.php#L65
For images, following functions are used if available, one after the other:
The availability of these functions depends on PHP version and available PHP extensions, and if avif images are included in the corresponding extensions or in case of mime_content_type in the magic file may depend on the particular PHP extension's version.
I am not at a computer to double check. Add avif to filetype and image extension settings. For the mime type please add the avif file manually to the images folder and click the info icon to see its mime type value to use for the mime type setting.
Labels |
Added:
Information Required
|
Thanks, @brianteeman , for letting me know about this.
I imagine the problem is that Joomla doesn't support AVIF, because PHP-GD doesn't support AVIF - which is because libgd doesn't include AVIF support?
If so, I'm working on that right now. You can follow my progress (and I very much hope there will be good news soon) at libgd/libgd#557 .
Just wanted to let you know that this PR is almost out of review. I expect it to be merged soon!
And... it's merged.
Thanks @morsssss for that PR there and for keeping us up to date.
So the next step is that they make a new release, then we can maybe pull it into the CMS (if no B/C breaks).
@morsssss Could you have an eye on it and let us know here when they've made a new release? If not, it's not a problem, just let us know then someone else will watch it hopefully. But if you can: Thanks in advance, that would really be a help.
GD 2.3.2 released: https://github.com/libgd/libgd/releases/tag/gd-2.3.2
on my php 7.4.9 is 2.3.0 for example
i didn't think it is a composer matter
but correct me if i'm wrong
did you mean this one ? https://github.com/joomla/joomla-cms/blob/4.0-dev/composer.json#L83
TIL over the weekend: PHP core maintainers told me that PHP's version of gd diverged from libgd long ago. I looked at the source, and, sure enough, it's true. It's quite different from libgd. It's even full of PHP-specific functions like zend_error()
.
Reading the last couple of comments, I looked at a sample PHP version of a GD file from v7.4.0. It, too, has zend_error()
.
I haven't been working with PHP much for the last few years. Do you know whether the external libgd is necessary at all? I do see it in the composer file @alikon just mentioned. I just don't know how it's used.
libavif
, on the other hand, should be required.
So, as far as I can tell, the next steps here are:
gd_avif.c
.getimagesize()
function to recognize AVIF. The good news is that there's already a PR for that.Just wanted to provide you all with an update.
My PR to propagate AVIF support into PHP's bundled gd library has been approved and merged. This should be included when PHP 8.1 is released in November. It'll be available in beta in July!
My followup PR to provide AVIF support in getimagesize()
and imagecreatefromstring()
is nearing approval as well.
So: it's good news!
@morsssss I created a package that adds support for Avif (amongst other things) to any Joomla 4 site:
https://responsive-images.dgrammatiko.dev/faq/index.html
code:
https://github.com/ttc-freebies/plugin-responsive-images/tree/4.0.0
@dgrammatiko hey, that's excellent!
You didn't need to wait for support in PHP? Do you use libgd or Imagick independently?
4.0.3 native ready for images AVIF?
4.0.3 native ready for images AVIF?
Not yet:
You can use https://responsive-images.dgrammatiko.dev though to get AVIF, WebP and srcsets for free
In any case, as far as I know, full AVIF support will be released in PHP 8.1.
And, yes, @dgrammatiko 's plugin :)
Labels |
Added:
No Code Attached Yet
bug
Removed: ? |
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-08-17 13:30:38 |
Closed_By | ⇒ | richard67 |
@hans2103 Have you added ".avif" to both the list of allowed file types "Legal Extensions (File Types)" and the list of allowed images "Legal Image Extensions (File Types)" in the media manager's options? And if "Check MIME Types" is switched on in the options, which is the default, have you also added "image/avif" to the list of allowed MIME types "Legal MIME Types"?