joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.77k stars 3.65k forks source link

4.1.x suggestion to improve media Legal Extensions and other popular formats #37669

Open mrownicki opened 2 years ago

mrownicki commented 2 years ago

it's 2022 and we don't make simple upload example docx. To add docx you need modification options in media. Time to add popular extensions. FIXED for ods,odt,odp MIME type is missing.

docx and the others format using a long time.

docx, pptx, xlsx, odp, ods, odt, epub,7z,aac

docx application/vnd.openxmlformats-officedocument.wordprocessingml.document

pptx application/vnd.openxmlformats-officedocument.presentationml.presentation

xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

odp application/vnd.oasis.opendocument.presentation

ods application/vnd.oasis.opendocument.spreadsheet

odt application/vnd.oasis.opendocument.text

epub application/epub+zip

7z application/x-7z-compressed

aac audio/aac

I added corrections to how it should look like options in media.

Allowed 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,docx,pptx,xlsx,epub,zip,7z,acc

Legal Audio Extensions (File Types) mp3,m4a,mp4a,ogg,acc

Legal Document Extensions (File Types) odg,odp,ods,odt,pdf,ppt,txt,xcf,xls,csv,docx,pptx,xlsx,epub

Legal MIME Types

image/jpeg,image/gif,image/png,image/bmp,image/webp,audio/ogg,audio/mpeg,audio/mp4,video/mp4,video/webm,video/mpeg,video/quicktime,application/msword,application/excel,application/pdf,application/powerpoint,text/plain,application/x-zip,application/x-7z-compressed,application/vnd.oasis.opendocument.text,application/vnd.oasis.opendocument.spreadsheet,application/vnd.oasis.opendocument.presentation,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.openxmlformats-officedocument.wordprocessingml.document,audio/aac,application/epub+zip

Expected result

Upload without any modification options in media.

Actual result

Manual add any instance joomla ...

Additional comments

Someone could help implement this and add file markings to show the file extension icons.

Still is something missing because .zip and .7z not upload. Maybe internal protection in joomla. screen shot 2022-04-26 at 18 19 24

dgrammatiko commented 2 years ago

If you're about to improve things then my suggestion is to completely drop the file extension and do everything based on mime types. File extension is FOOBAR in the web, here's a simple proof: rename on your machine a jpg image by removing the extension part (eg from filename.jpg to filename) and try to upload it! The image is completely legal and safe to upload and use in the CMS, but depending on some settings this might not be possible right now. Just drop the legacy extension checks (which are also totally unsafe, security wise), the touches in the UI parts are minimal (that's if I did an ok work the last time I messed with that part of media manager). My 2c

mrownicki commented 2 years ago

@dgrammatiko you have right. Generally, I would let everything load and for restriction using allow type MIME and forbidden type. That's all. Mostly anyway, I bypass Media and upload via ftp so as not to mess with the constant setting.

This is my suggestion because I noticed that since version 3 nothing has changed. I would be happy to help if I was a programmer :(

I also believe that the people who contribute the most should simply be rewarded with $$$ for their work. Something like Contributor of the year 🥇 Motivation and gratifications.

Ps. You're doing a great job! Thank you on behalf of everyone!

dgrammatiko commented 2 years ago

@mrownicki probably you should ping @Quy as he already started some work on this https://github.com/joomla/joomla-cms/pull/36723

ssnobben commented 2 years ago

How about support for the AVIF image format?

"What is an AVIF image format?

The AV1 image format (AVIF) is an exciting new open-sourced and royalty free optimised image format which supports any image codec. An AVIF image offers significant file size reduction compared with JPEG, PNG and WebP and is currently supported on Google Chrome, Firefox and Android."


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

dgrammatiko commented 2 years ago

Avif needs php >8.1

ssnobben commented 2 years ago

Avif needs php >8.1 yes I know. Is that a problem?

my sites have php 8.1.4 everywhere long time support 8.1 now and then it should work and latest Ubuntu LTS is php 8.1 std.

If Joomla support it now would that be a problem for people that are running below php 8.1 ?

dgrammatiko commented 2 years ago

@ssnobben you probably won't use Avif directly in your site (eg you need some kind of fallback for browsers that don't support the format yet). You can still use some extension for this (eg one that I know that works is by me: https://extensions.joomla.org/extension/responsive-images that will produce WebP and Avif [assuming your server supports them], check the images in this template: https://sloth.dgrammatiko.dev). About Joomla adding support for Avif: probably it's doable but with some limitations

mrownicki commented 2 years ago

PHP 8.1 GD library support AVIF this need only for manipulation, convert etc. For only display this format, browser must support ;) or make fallback to jpg or webp https://caniuse.com/avif Opera, FF, Chrome support. As always, safari is delay hehe