No Code Attached Yet Information Required bug
avatar hans2103
hans2103
17 Sep 2020

Steps to reproduce the issue

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.

  • Login Joomla 4.0 Administrator > Content > Media
  • Try to upload the AVIF image

Expected result

The file should be uploaded

Actual result

Schermafbeelding 2020-09-17 om 10 11 46

Requested change

The media manager should be adjusted to allow uploading AVIF images.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
3.00

avatar hans2103 hans2103 - open - 17 Sep 2020
avatar joomla-cms-bot joomla-cms-bot - change - 17 Sep 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 17 Sep 2020
avatar richard67
richard67 - comment - 17 Sep 2020

@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"?

avatar hans2103
hans2103 - comment - 17 Sep 2020

Joomla Administrator > Content > Media > Options

  • Legal Extensions (File Types) => added ,avif,AVIF
  • Check MIME Types = YES (by default)
  • Legal Image Extensions (File Types) => added avif
  • Legal MIME Types => added 'image/avif`

Tried to upload an AVIF image.
The result:

Schermafbeelding 2020-09-17 om 10 35 07

Concluding two things:

  • there is no English translation for this text variable
  • it is not possible to upload an avif image
avatar hans2103 hans2103 - change - 17 Sep 2020
Title
[4.0] [media manager] not possible to upload an avif image
[4.0] com_media not possible to upload an avif image
avatar hans2103 hans2103 - edited - 17 Sep 2020
avatar SharkyKZ
SharkyKZ - comment - 17 Sep 2020

The MIME type is image/heif.

avatar SharkyKZ
SharkyKZ - comment - 17 Sep 2020

For missing string issue see PR #30671.

avatar hans2103
hans2103 - comment - 18 Sep 2020

Added MIME type image/heif. Uploading an AVIF image is not possible with the same error message as mentioned earlier

avatar SharkyKZ
SharkyKZ - comment - 18 Sep 2020

Can you post a link to the image for testing?

avatar hans2103
hans2103 - comment - 18 Sep 2020

I've been using one of the avif images downloaded from the article mentioned in the description of this issue

avatar richard67
richard67 - comment - 18 Sep 2020

What happens if you switch off "Check MIME Types" in media manager options?

avatar SharkyKZ
SharkyKZ - comment - 18 Sep 2020

It's recognized as having application/octet-stream MIME type. There's PR #25351 for improving MIME detection but I don't think it's going to help in this case.

avatar richard67
richard67 - comment - 18 Sep 2020

Yes, but I wanted to know what happens when the MIME type check is switched off.

avatar SharkyKZ
SharkyKZ - comment - 18 Sep 2020

It works without MIME check.

avatar richard67
richard67 - comment - 18 Sep 2020

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?

avatar richard67
richard67 - comment - 19 Sep 2020

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:

  • exif_imagetype
  • getimagesize
  • mime_content_type
  • finfo_open

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.

avatar Quy
Quy - comment - 25 Oct 2020

Please test PR #31233 using mimetype application/octet-stream.

avatar hans2103
hans2103 - comment - 27 Oct 2020

PR #31233 has already been merged.
@Quy what should I change in the settings to get an .avif file being uploaded?
The mentioned error remains

avatar Quy
Quy - comment - 27 Oct 2020

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.

avatar Quy Quy - change - 28 Oct 2020
Labels Added: Information Required
avatar Quy Quy - labeled - 28 Oct 2020
avatar Quy
Quy - comment - 8 Jan 2021

Using application/octet-stream works for me.

avif

avatar morsssss
morsssss - comment - 16 Jan 2021

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 .

avatar morsssss
morsssss - comment - 26 Feb 2021

Just wanted to let you know that this PR is almost out of review. I expect it to be merged soon!

avatar morsssss
morsssss - comment - 4 Mar 2021

And... it's merged.

avatar richard67
richard67 - comment - 4 Mar 2021

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.

avatar morsssss
morsssss - comment - 6 Mar 2021

Yes - definitely!

I'm following the progress here.

avatar Quy
Quy - comment - 10 Mar 2021
avatar alikon
alikon - comment - 10 Mar 2021

on my php 7.4.9 is 2.3.0 for example

avatar richard67
richard67 - comment - 10 Mar 2021

@alikon It needs to fetch gd-2.3.2 with a composer update. Could you make the PR?

avatar alikon
alikon - comment - 10 Mar 2021

i didn't think it is a composer matter
but correct me if i'm wrong 😃

avatar alikon
alikon - comment - 10 Mar 2021
avatar richard67
richard67 - comment - 10 Mar 2021

@alikon I think so, but I might also be wrong.

avatar morsssss
morsssss - comment - 10 Mar 2021

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:

  • propagate the new AVIF support from libgd into PHP's fork. This mostly involves gd_avif.c.
  • Get PHP's getimagesize() function to recognize AVIF. The good news is that there's already a PR for that.
avatar morsssss
morsssss - comment - 18 Jun 2021

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!

avatar dgrammatiko
dgrammatiko - comment - 2 Jul 2021

@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

avatar morsssss
morsssss - comment - 2 Jul 2021

@dgrammatiko hey, that's excellent!

You didn't need to wait for support in PHP? Do you use libgd or Imagick independently?

avatar Stuartemk
Stuartemk - comment - 16 Sep 2021

4.0.3 native ready for images AVIF?

avatar dgrammatiko
dgrammatiko - comment - 16 Sep 2021

4.0.3 native ready for images AVIF?

Not yet:

default="bmp,gif,jpg,jpeg,png,webp"

You can use https://responsive-images.dgrammatiko.dev though to get AVIF, WebP and srcsets for free

avatar morsssss
morsssss - comment - 16 Sep 2021

In any case, as far as I know, full AVIF support will be released in PHP 8.1.

And, yes, @dgrammatiko 's plugin :)

avatar Hackwar Hackwar - change - 20 Feb 2023
Labels Added: No Code Attached Yet bug
Removed: ?
avatar Hackwar Hackwar - labeled - 20 Feb 2023
avatar brianteeman
brianteeman - comment - 10 Apr 2023

is this resolved with #35752 ??

avatar richard67 richard67 - change - 17 Aug 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-08-17 13:30:38
Closed_By richard67
avatar richard67 richard67 - close - 17 Aug 2023
avatar richard67
richard67 - comment - 17 Aug 2023

Closing as having a pull request. Please test #41381 . Thanks in advance.

Add a Comment

Login with GitHub to post a comment