igamov / filament-media-gallery
This package add support spatie media library to filament V3.x
Fund package maintenance!
igamov
Requires
- php: ^8.1
- filament/filament: ^3.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.1
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-medialibrary: ^10.0|^11.0
This package is auto-updated.
Last update: 2025-03-08 18:39:49 UTC
README
This package add support spatie media library to filament V3.x
I've taken inspiration from the following plugins: Json Media & Filament Spatie Media Library.
Installation
You can install the package via composer:
composer require igamov/filament-media-gallery
Optionally, you can publish the views using
php artisan vendor:publish --tag="filament-media-gallery-views"
Usage
In Filament Forms
use Igamov\FilamentMediaGallery\Form\MediaGallery; MediaGallery::make('gallery') ->collection('gallery') ->thumb('tiny_conversion') ->disk('disk') ->columnSpanFull() ->reorderable(true) ->downloadable() ->maxSize(1536) ->multiple()
In Filament Tables
To use the media gallery image column:
use Igamov\FilamentMediaGallery\Tables\Columns\MediaGalleryImageColumn; MediaGalleryImageColumn::make('avatar')
The media gallery image column supports all the customization options of the original image column.
Passing a collection
Optionally, you may pass a collection()
:
use Igamov\FilamentMediaGallery\Tables\Columns\MediaGalleryImageColumn; MediaGalleryImageColumn::make('avatar') ->collection('avatars')
The collection allows you to group files into categories.
By default, only media without a collection (using the default
collection) will be shown. If you want to show media from all collections, you can use the allCollections()
method:
use Igamov\FilamentMediaGallery\Tables\Columns\MediaGalleryImageColumn; MediaGalleryImageColumn::make('avatar') ->allCollections()
Using conversions
You may also specify a conversion()
to load the file from showing it in the table, if present:
use Igamov\FilamentMediaGallery\Tables\Columns\MediaGalleryImageColumn; MediaGalleryImageColumn::make('avatar') ->conversion('thumb')
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.