Components
Media Library
Integrations
Media Library Item-driver
The MediaLibraryItemDriver allows you to combine the best of Spatie Media Library with the flexibility of re-using media items across models. Furthermore, storing media items is as easy as storing just a single ID.
Pros
- Image/PDF conversions built-in.
- Proven technology & scalability with over 28 million installs.
- Can handle non-unique file names easily.
- Easy response-image integration for use on (Blade-based) frontends.
- Link selected images to your models using a database ID and foreign key.
- More performant searching through large libraries.
Cons
- Storing a selection of multiple
MediaLibraryItem's can be done using a JSON-column with integer IDs or a separate pivot table, which is less intuitive.
Installation
Install Spatie Media Library package
To use the MediaLibraryItemDriver, you need to install the Spatie Media Library package and follow the instructions in the Spatie Media Library documentation:
Next, publish and run the package migrations:
Review disk
The Spatie Media Library stores all media on a disk. By default, this is the public disk. It is recommended to verify the disk before storing any media:
Configure driver
The MediaLibraryItemDriver is the default driver of the Media Library, so it doesn't need to be specifically enabled.
That's it! You now have a fully functional Media Library running Spatie Medialibrary as a driver.