Components
Media Library
Integrations
Storage/disk driver
The FilesystemStorageDriver allows you to let the Media Library run on top of any Laravel filesystem disk. This works both for disks that already have data, as well as entirely empty disks. The Media Library works interchangeably with any other disk operations, thus zero configuration is needed.
Pros
- Link selected images to your models using a string path to their file.
- Easy to integrate with existing projects that already have their own media library structure.
- Image conversions built with Glide, Cloudflare Images & Bunny.net Dynamic Image Processing.
- Support any file type.
Cons
- No PDF/video-previews built-in.
- Authorization required to ensure that used images are not deleted.
- No duplicate file handling (if allowed to upload preserving name).
- No built-in ability to store metadata (like alt-text).
Installation
Configure driver
To use the FilesystemStorageDriver, make sure you have configured the Laravel Filesystem storage disk that you want to use.
Next, register the driver as follows:
Review disk
By default, the FilesystemStorageDriver uses the public disk. It is recommended to verify the disk before storing any media:
Review directory
In addition to the disk, you can also specify a directory within the disk:
That's it! You now have a fully functional Media Library running on your filesystem storage disk as a driver.