Add support for Media Library metadata
Open
@bennothommo is already working on this.
Since Feb 2, 2022.
high priority
- Dominant language
- PHP
- Stars
- 1.5k
- Forks
- 246
- Avg merge
- 19h 2m
- Merged PRs (30d)
- 7
Description

General:
- This is a progressive enhancement that will live in the System module. Simply check if app::hasDatabase() or something similar before registering event listeners
- Media Manager should have integrations with the Form widget to simply extending it
- Perhaps handle https://github.com/rainlab/translate-plugin/issues/192 as a part of this
Schema:
Table Name: media_library_items
id // To simplify other people's relationships to Media Items
disk // To distinguish between multiple files stored on different disks
path // The path to the media item
metadata // JSON stored metadata.
timestamps?
Model:
Name: MediaItem
Interface:
MediaItem::fromPath($path, $disk = $defaultDisk) // Gets the Media metadata for the specified path
- Provide method to load metadata directly from the identifier passed that would override the stored metadata. I.e. Path could be either a string or an array containing overriding metadata.
- Perhaps have getAttribute() attempt to pull unknown attributes from the ->metadata->$attribute?
- Perhaps have setAttribute() do the same?
- Take inspiration from https://github.com/kodeine/laravel-meta.
Interactions:
- Media Metadata integration will listen to the media events and update the DB reference to the path on the appropriate events
- Attempting to access a MediaItem that doesn't exist in the DB yet will create it in the DB (perhaps only if it exists in the disk?)
- Perhaps integrate File Interface for using in the file model and Media Item model?
- Twig interface should be
{{ media(path, optionalDisk).mediaItemPropertyOrMethod }}
Perhaps take some extensibility inspirations from https://github.com/ctf0/Laravel-Media-Manager
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.