Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.0] AVIF support for media manager #41381

Merged
merged 4 commits into from Sep 2, 2023
Merged

[5.0] AVIF support for media manager #41381

merged 4 commits into from Sep 2, 2023

Conversation

wilsonge
Copy link
Contributor

@wilsonge wilsonge commented Aug 17, 2023

Allow media manager to have AVIF files uploaded and rendered

Summary of Changes

AVIF is an alternative to webp in some circumstances (see https://www.smashingmagazine.com/2021/09/modern-image-formats-avif-webp/ for more info).

I've deliberately chosen to not add this to a SQL Update script so there are no security implications for sites who may have more restrictive upload policies. This will only apply to new sites.

Worth noting this is a better fit for J5 than J4.4 because the GD library support was only added in PHP 8.1 (although technically that doesn't stop people uploading the files themselves in J4.4 as web browser support already exists - it's just easier because they can be edited too) - https://php.watch/versions/8.1/gd-avif

Testing Instructions

Upload AVIF file. Before will be rejected and any files on the server won't be rendered. Afterwards they will be.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

Allow media manager to have AVIF files uploaded and rendered
@brianteeman
Copy link
Contributor

Does this close the following

#30666
#37669

Also see the changes made with #35752

@richard67
Copy link
Member

@wilsonge You've changed the base.sql file for MySQL but not the one for PostgreSQL. This cannot be right.

@wilsonge
Copy link
Contributor Author

#35752 is just for the image list field (I'm not aware of anywhere we use that in core). But people would have needed to upload those files by hand. This PR specifically addresses media manager.

Yes it will address #30666. However it will only address the AVIF part of #37669 (the original issue was a broader thing around document formats etc which obviously isn't covered here)

@Quy
Copy link
Contributor

Quy commented Aug 17, 2023

Update?

static $imageTypes = 'xcf|odg|gif|jpg|jpeg|png|bmp|webp';

'image/jpeg,image/gif,image/png,image/bmp,image/webp,application/msword,application/excel,' .

$allowable = array_map('trim', explode(',', $params->get('restrict_uploads_extensions', 'bmp,gif,jpg,jpeg,png,webp,ico,mp3,m4a,mp4a,ogg,mp4,mp4v,mpeg,mov,odg,odp,ods,odt,pdf,png,ppt,txt,xcf,xls,csv')));

$allowedExtensions = array_map('trim', explode(',', $params->get('restrict_uploads_extensions', 'bmp,gif,jpg,jpeg,png,webp,ico,mp3,m4a,mp4a,ogg,mp4,mp4v,mpeg,mov,odg,odp,ods,odt,pdf,png,ppt,txt,xcf,xls,csv')));

@wilsonge
Copy link
Contributor Author

Done!

@Hackwar Hackwar added the PBF Pizza, Bugs and Fun label Aug 25, 2023
@tomsrocket
Copy link

I can confirm this works.

@MacJoom
Copy link
Contributor

MacJoom commented Aug 26, 2023

I have tested this item ✅ successfully on d0ec800

On 5.0.0-alpha4
you have to setup the file type and mime type in options


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41381.

@Magnytu2
Copy link

It works but doesn't produce a thumbnail in the media manager, and the instructions for adding .avif files are missing from the settings.screen shot 2023-08-26 at 13 34 54


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41381.

@HLeithner
Copy link
Member

It works but doesn't produce a thumbnail in the media manager, and the instructions for adding .avif files are missing from the settings.screen shot 2023-08-26 at 13 34 54

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41381.

is it possible that you server doesn't support av1?

@brianteeman
Copy link
Contributor

To test to see if your server supports avif see https://php.watch/versions/8.1/gd-avif

@wilsonge
Copy link
Contributor Author

wilsonge commented Sep 1, 2023

Also to check if you use patchtester you will need to manually update the parameters in media manager

@HLeithner HLeithner merged commit 8913b62 into 5.0-dev Sep 2, 2023
5 of 6 checks passed
@HLeithner
Copy link
Member

thx

@HLeithner HLeithner deleted the avif-media-manager branch September 2, 2023 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PBF Pizza, Bugs and Fun PR-5.0-dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants