- How do I integrate this plugin into an existing Filament admin panel?
- Install via Composer (`filament/spatie-laravel-media-library-plugin`), publish Spatie’s migrations, and run them. Then use `SpatieMediaLibraryFileUpload` in your Filament forms like the native `FileUpload` component. No extra JS or CSS is needed—it works out-of-the-box with Filament’s UI.
- Does this plugin support custom storage disks like S3 or Wasabi?
- Yes, it inherits Spatie’s disk flexibility. Use the `disk()` method on the field (e.g., `->disk('s3')`) or configure collections to use specific disks via Spatie’s config. Filament’s default disk setting is ignored unless overridden per field.
- Can I use media collections (e.g., 'avatars', 'documents') with this plugin?
- Absolutely. Pass a `collection()` name to the field (e.g., `->collection('avatars')`), then define the collection in Spatie’s config with disk/directory rules. Collections let you organize media logically and apply per-collection storage settings.
- Will this work with Laravel 9/10 and Filament v2.5+?
- The plugin targets Laravel 8+ and Filament v2+. For Laravel 9/10, ensure you’re on `^5.0` of the plugin, which aligns with Spatie’s latest versions. Check the [Filament compatibility table](https://filamentphp.com/docs/installation#laravel-versions) for minor version quirks.
- How do I add media fields to Filament tables or resources?
- Use `SpatieMediaLibraryFileUpload` in forms or `SpatieMediaLibraryTableColumn` in tables. For resources, define the field in your `Form` or `Table` classes. Example: `SpatieMediaLibraryTableColumn::make('media')->collection('images')` for displaying media in a table.
- Does this plugin handle file transformations (e.g., thumbnails, resizing)?
- Yes, it leverages Spatie’s `convert()` and `convertImmediately()` methods. Define transformations in Spatie’s config (e.g., `thumbnails`, `video_thumbnails`) and they’ll apply automatically when files are uploaded via the plugin’s field.
- What if I already use `spatie/laravel-medialibrary` but not Filament?
- The plugin adds zero overhead if you’re already using Spatie’s package. It simply wraps the media library in Filament’s UI components. No migrations or model changes are needed—just install the plugin and replace native file uploads with `SpatieMediaLibraryFileUpload`.
- How do I customize the media upload UI (e.g., allowed file types, preview size)?
- Use Filament’s built-in methods like `->acceptedFileTypes(['jpg', 'png'])`, `->maxSize(1024)`, or `->previewMode('contain')`. For advanced tweaks, override the plugin’s Blade views or use Filament’s `modify` methods to inject custom JS/CSS.
- Can I use this for bulk media uploads or drag-and-drop in Filament?
- Yes, the plugin supports drag-and-drop via Filament’s native `FileUpload` base. For bulk actions, use Spatie’s `Media` model methods (e.g., `delete()`, `each()`) in Filament’s `Table` actions or custom widgets. Pagination is handled automatically for large collections.
- Are there performance concerns with thousands of media files?
- For large libraries, enable Spatie’s `lazy-loading` or `server-side processing` via config. The plugin itself doesn’t add significant overhead, but complex queries (e.g., `withMetadata`) may need optimization. Test with `DB::enableQueryLog()` to identify slow queries.