igamov/filament-media-gallery

This package add support spatie media library to filament V3.x

v1.0.0 2024-06-28 12:42 UTC

This package is auto-updated.

Last update: 2024-09-08 17:38:27 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.

filament-media-gallery.png

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.