PHP code example of ww-site / filament-gallery

1. Go to this page and download the library: Download ww-site/filament-gallery library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ww-site / filament-gallery example snippets


   ->plugin(\WwGallery\FilamentGallery\FilamentGalleryPlugin::make())
   

$source = \WwGallery\FilamentGallery\Models\MediaSource::create([
    'name' => 'Изображения категорий',
    'slug' => 'category-images',
    'is_active' => true,
]);
$source->settings()->create(['key' => 'disk',      'value' => 'public',     'sort_order' => 10]);
$source->settings()->create(['key' => 'directory', 'value' => 'categories', 'sort_order' => 20]);

use WwGallery\FilamentGallery\Forms\Components\MediaPicker;

MediaPicker::make('image')
    ->label('Изображение категории')
    ->mediaSourceSlug('category-images')
    ->imagesOnly();

use WwGallery\FilamentGallery\Tables\Columns\MediaPreviewColumn;

MediaPreviewColumn::make('image')
    ->label('Изображение')
    ->mediaSourceSlug('category-images');

use WwGallery\FilamentGallery\Infolists\Components\MediaPreviewEntry;

MediaPreviewEntry::make('image')
    ->label('Изображение')
    ->mediaSourceSlug('category-images');

media_source_image('slider-images', $path, [
    'width' => 1200,
    'height' => 600,
    'format' => 'webp',
    'quality' => 85,
    'crop' => true,
]);

FilamentGalleryPlugin::make()
    ->registerGalleryPage(false)
    ->registerMediaSourcesResource();

   php artisan vendor:publish --tag=filament-gallery-config
   php artisan vendor:publish --tag=filament-gallery-translations
   
css
/* Package Blade views */
@source '../../../../vendor/ww-site/filament-gallery/resources/views/**/*';

/* Tailwind classes inside PHP (HtmlString labels, etc.) */
@source '../../../../vendor/ww-site/filament-gallery/src/**/*.php';