chamilo / chamilo-lms

Chamilo is a learning management system focused on ease of use and accessibility
https://chamilo.org
GNU General Public License v3.0
769 stars 470 forks source link

[C2] Allow multi-format media files #5600

Closed ywarnier closed 1 day ago

ywarnier commented 2 weeks ago

The idea behind files management in C2 is to allow for some resources to have multiple file formats. But this seems to have been implemented slightly wrong: the resource_file table should have a resource_node_id field, and not the other way around (resource_node having a resource_file_id).

Changing this (in entities and migrations - migrations will be slightly tricky to do) will allow us to have one single resource and define files in different mime types and dimensions.

The ResourceController should then receive requests for nodes, find the available corresponding files, and decide which one is best.

2 obvious use cases for now are:

For now, we just need fixing the database structure and changing the ResourceController to have the basics to later improve support for different formats. Later on (in another issue) we will implement files conversions (through php-imagick and php-ffmpeg if available) and best-format decisions based on browser capabilities.