### Install Lightbox Package via Composer
Source: https://github.com/njxqlus/filament-lightbox/blob/main/README.md
This command installs the filament-lightbox package using Composer, a dependency manager for PHP. Ensure Composer is installed and accessible in your terminal.
```bash
composer require njxqlus/filament-lightbox
```
--------------------------------
### Run Package Tests
Source: https://github.com/njxqlus/filament-lightbox/blob/main/README.md
This command executes the test suite for the filament-lightbox package. It's crucial for verifying the package's functionality and ensuring no regressions have been introduced. Make sure you have the necessary testing dependencies installed.
```bash
composer test
```
--------------------------------
### Publish Lightbox Configuration
Source: https://github.com/njxqlus/filament-lightbox/blob/main/README.md
This command publishes the configuration file for the filament-lightbox package. This file allows you to set various options and customize the lightbox behavior. Execute this command in your terminal.
```bash
php artisan vendor:publish --tag="filament-lightbox-config"
```
--------------------------------
### Publish Lightbox Views
Source: https://github.com/njxqlus/filament-lightbox/blob/main/README.md
This command publishes the view files for the filament-lightbox package. This allows for customization of the lightbox's appearance. Run this command in your terminal.
```bash
php artisan vendor:publish --tag="filament-lightbox-views"
```
--------------------------------
### Basic Image Lightbox with LightboxImageEntry
Source: https://context7.com/njxqlus/filament-lightbox/llms.txt
Demonstrates the basic usage of LightboxImageEntry in Filament's infolist system. It allows displaying images in a lightbox overlay with full-size previews, supporting direct URLs, custom thumbnails, and dynamic URL generation via closures. It also supports standard Filament ImageEntry methods like 'circular', 'width', 'height', and 'label'.
```php
use Njxqlus\Filament\Components\Infolists\LightboxImageEntry;
use Filament\Infolists\Infolist;
public static function infolist(Infolist $infolist):
Infolist
{
return $infolist
->schema([
// Basic usage - href() defines the full-size image
LightboxImageEntry::make('thumbnail')
->href('https://example.com/images/full-size.jpg'),
// Custom thumbnail with different full-size image
LightboxImageEntry::make('avatar')
->image('https://example.com/images/thumb-200x200.jpg')
->href('https://example.com/images/full-1920x1080.jpg'),
// Use Filament ImageEntry methods
LightboxImageEntry::make('profile_photo')
->href(fn ($record) => $record->photo_url)
->circular()
->width(100)
->height(100)
->label('Profile Picture'),
// Closure support for dynamic URLs
LightboxImageEntry::make('product_image')
->image(fn ($record) => $record->thumbnail_url)
->href(fn ($record) => $record->full_image_url)
->square()
->label('Product Photo'),
]);
}
```
--------------------------------
### Display Spatie Media Library Images with Lightbox
Source: https://context7.com/njxqlus/filament-lightbox/llms.txt
Integrates Spatie Media Library images into Filament, enabling automatic gallery creation and image conversion support for previews. It allows for various configurations, including custom conversions, aspect ratios, and handling of private media with temporary URLs.
```php
use Njxqlus\Filament\Components\Infolists\LightboxSpatieMediaLibraryImageEntry;
use Filament\Infolists\Infolist;
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
// Basic media library integration
LightboxSpatieMediaLibraryImageEntry::make('gallery')
->collection('product-images'),
// With thumbnail conversion - shows thumb, opens full size
LightboxSpatieMediaLibraryImageEntry::make('photos')
->collection('project-photos')
->conversion('thumb') // Display thumbnail conversion
->circular()
->width(150)
->height(150),
// Full configuration example
LightboxSpatieMediaLibraryImageEntry::make('portfolio')
->collection('portfolio-items')
->conversion('medium') // Use medium conversion for preview
->square()
->width(200)
->height(200)
->slideWidth('1920px') // Full-size opens at custom dimensions
->slideHeight('1080px')
->slideEffect('zoom')
->slideZoomable(true)
->slideDraggable(true)
->label('Portfolio Gallery'),
// Private visibility with temporary URLs
LightboxSpatieMediaLibraryImageEntry::make('private_documents')
->collection('confidential')
->conversion('preview')
->visibility('private') // Generates 5-minute temporary URLs
->slideZoomable(false),
]);
}
// Example model setup with Spatie Media Library
use Illuminate\Database\Eloquent\Model;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
class Product extends Model implements HasMedia
{
use InteractsWithMedia;
public function registerMediaCollections(): void
{
$this->addMediaCollection('product-images')
->useFallbackUrl('/images/placeholder.jpg');
}
public function registerMediaConversions(?Media $media = null): void
{
$this->addMediaConversion('thumb')
->width(200)
->height(200)
->sharpen(10);
$this->addMediaConversion('medium')
->width(800)
->height(600);
}
}
```
--------------------------------
### Apply ImageEntry Methods to Lightbox in PHP
Source: https://github.com/njxqlus/filament-lightbox/blob/main/README.md
This PHP code shows how to apply standard Filament ImageEntry methods, such as `circular()` and `label()`, to the LightboxImageEntry. This allows for consistent styling and configuration within your Filament forms and infolists. Note that the `url()` method is not supported.
```php
use Njxqlus\Filament\Components\Infolists\LightboxImageEntry;
LightboxImageEntry::make('foo')
->href('https://biati-digital.github.io/glightbox/demo/img/large/gm2.jpg')
->circular()
->label('Bar')
```
--------------------------------
### Lightbox Spatie Media Library Image Entry in PHP
Source: https://github.com/njxqlus/filament-lightbox/blob/main/README.md
This PHP code demonstrates the LightboxSpatieMediaLibraryImageEntry, which integrates the Spatie Media Library plugin with lightbox functionality. It allows you to display media library images in a lightbox. You can specify the collection, conversion, and apply standard entry methods.
```php
use Njxqlus\Filament\Components\Infolists\LightboxSpatieMediaLibraryImageEntry;
LightboxSpatieMediaLibraryImageEntry::make('foo')
->collection('images')
->conversion('thumb')
->circular()
->label('Bar')
```
--------------------------------
### Configure GLightBox Options in PHP
Source: https://github.com/njxqlus/filament-lightbox/blob/main/README.md
This PHP code shows how to configure GLightbox options directly through chain methods prefixed with 'slide'. This allows fine-grained control over the lightbox's behavior and appearance, such as setting descriptions, width, and height.
```php
use Njxqlus\Filament\Components\Infolists\LightboxImageEntry;
use Illuminate\Support\HtmlString;
LightboxImageEntry::make('foo')
->href('https://biati-digital.github.io/glightbox/demo/img/large/gm2.jpg')
->slideDescription(new HtmlString('Lightbox'))
->slideWidth('906px')
->slideHeight('500px')
```
--------------------------------
### Create Lightbox Image Entry in PHP
Source: https://github.com/njxqlus/filament-lightbox/blob/main/README.md
This PHP code demonstrates how to create a LightboxImageEntry in Filament. It extends the default ImageEntry and wraps it with lightbox functionality. The `href()` method is used to specify the URL of the image to be displayed in the lightbox.
```php
use Njxqlus\Filament\Components\Infolists\LightboxImageEntry;
LightboxImageEntry::make('foo')
->href('https://biati-digital.github.io/glightbox/demo/img/large/gm2.jpg')
```
--------------------------------
### Configure Global GLightbox Options
Source: https://context7.com/njxqlus/filament-lightbox/llms.txt
Sets global configuration options for all GLightbox instances used within the application. This file allows customization of various aspects of the lightbox behavior, such as effects, navigation, and appearance.
```php
// config/filament-lightbox.php
return [
'selector' => '.glightbox',
'skin' => 'clean', // 'clean', 'modern', 'dark'
'openEffect' => 'zoom', // 'zoom', 'fade', 'none'
'closeEffect' => 'zoom',
'slideEffect' => 'slide', // 'slide', 'fade', 'zoom', 'none'
'moreText' => 'See more',
'moreLength' => 60,
'closeButton' => true,
'touchNavigation' => true,
'touchFollowAxis' => true,
'keyBoardNavigation' => true,
'closeOnOutsideClick' => true,
'loop' => false, // Loop through gallery
'dragToleranceX' => 40,
'dragToleranceY' => 65,
'dragAutoSnap' => false,
'preload' => true, // Preload adjacent slides
'autoplayVideos' => true,
'autofocusVideos' => false,
];
```
--------------------------------
### Create Lightbox Image Entry with Image URL in PHP
Source: https://github.com/njxqlus/filament-lightbox/blob/main/README.md
This PHP code shows how to create a LightboxImageEntry where the image URL is provided via the `image()` method, which accepts a Closure. This is useful for dynamically determining the image source. The `href()` method still specifies the URL for the lightbox.
```php
use Njxqlus\Filament\Components\Infolists\LightboxImageEntry;
LightboxImageEntry::make('foo')
->image('https://biati-digital.github.io/glightbox/demo/img/large/gm2.jpg')
->href('https://biati-digital.github.io/glightbox/demo/img/large/gm2.jpg')
```
--------------------------------
### Create a Lightbox Component with Schema in PHP
Source: https://github.com/njxqlus/filament-lightbox/blob/main/README.md
This PHP code defines a Lightbox component that can encapsulate other Filament entries within its schema. This allows you to trigger a lightbox that displays the content defined in the schema, linked via the `href()` method.
```php
use Njxqlus\Filament\Components\Infolists\Lightbox;
use Filament\Infolists\Components\TextEntry;
Lightbox::make()
->schema([
TextEntry::make('foo')
])
->href('https://biati-digital.github.io/glightbox/demo/img/large/gm2.jpg')
```
--------------------------------
### Customize GLightbox Slide Behavior with PHP
Source: https://context7.com/njxqlus/filament-lightbox/llms.txt
Configure GLightbox slide options such as title, description, dimensions, and effects using the LightboxImageEntry component in PHP. This allows for fine-tuned control over how images and other content are presented in the lightbox. Dependencies include the Njxqlus Filament components and Illuminate Support.
```php
use Njxqlus\Filament\Components\Infolists\LightboxImageEntry;
use Illuminate\Support\HtmlString;
use Filament\Infolists\Infolist;
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
LightboxImageEntry::make('banner')
->href('https://example.com/banner.jpg')
->slideTitle('Company Banner 2024')
->slideDescription(new HtmlString('Official promotional banner
Created: March 2024'))
->slideDescPosition('bottom') // 'top', 'bottom', 'left', 'right'
->slideWidth('1200px')
->slideHeight('675px')
->slideEffect('fade') // 'zoom', 'fade', 'slide', 'none'
->slideZoomable(true) // Enable zoom functionality
->slideDraggable(true) // Enable drag to navigate
->slideType('image'), // 'image', 'video', 'inline', 'external'
// Disable interactive features for sensitive content
LightboxImageEntry::make('watermarked_proof')
->href(fn ($record) => $record->proof_url)
->slideZoomable(false)
->slideDraggable(false)
->slideDescription('Copyrighted Material - Do Not Reproduce'),
// Dynamic configuration with closures
LightboxImageEntry::make('responsive_image')
->href(fn ($record) => $record->image_url)
->slideWidth(fn ($record) => $record->is_portrait ? '600px' : '1200px')
->slideHeight(fn ($record) => $record->is_portrait ? '900px' : '675px')
->slideTitle(fn ($record) => $record->image_title)
->slideEffect(fn () => auth()->user()->prefers_animations ? 'zoom' : 'fade'),
]);
}
```
--------------------------------
### Wrap Custom Content in Lightbox Modal with PHP
Source: https://context7.com/njxqlus/filament-lightbox/llms.txt
Use the Filament Lightbox component to wrap custom infolist components, enabling them to open in a lightbox modal. This feature supports various components like TextEntry and Grid, and can be configured with dynamic URLs, dimensions, and titles. Dependencies include Njxqlus Filament components and Filament Infolists.
```php
use Njxqlus\Filament\Components\Infolists\Lightbox;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Components\Grid;
use Filament\Infolists\Infolist;
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
// Wrap text entries to open in lightbox
Lightbox::make()
->schema([
TextEntry::make('company_name')
->label('Company'),
TextEntry::make('description')
->label('Description')
->markdown(),
])
->href('https://example.com/document.jpg'),
// Complex nested components
Lightbox::make()
->schema([
Grid::make(2)
->schema([
TextEntry::make('invoice_number'),
TextEntry::make('invoice_date'),
TextEntry::make('amount')
->money('usd'),
TextEntry::make('status')
->badge(),
]),
])
->href(fn ($record) => $record->invoice_pdf_url)
->slideWidth('800px')
->slideHeight('600px')
->slideTitle('Invoice Details'),
// Trigger lightbox with any clickable content
Lightbox::make()
->schema([
TextEntry::make('view_contract')
->label('Click to View Contract')
->default('Open Document'),
])
->href(fn ($record) => $record->contract_scan_url)
->slideGallery('legal-documents'),
]);
}
```
--------------------------------
### Create Separate Lightbox Galleries in PHP
Source: https://github.com/njxqlus/filament-lightbox/blob/main/README.md
This PHP code demonstrates how to create distinct lightbox galleries using the `slideGallery()` method. Images assigned to the same gallery name will be navigable within that gallery using arrows. Images with different gallery names will be in separate galleries.
```php
use Njxqlus\Filament\Components\Infolists\LightboxImageEntry;
LightboxImageEntry::make('foo')
->href('https://biati-digital.github.io/glightbox/demo/img/large/gm2.jpg')
->slideGallery('qux-gallery')
LightboxImageEntry::make('bar')
->href('https://biati-digital.github.io/glightbox/demo/img/large/gm8.jpg')
->slideGallery('qux-gallery')
LightboxImageEntry::make('baz')
->href('https://biati-digital.github.io/glightbox/demo/img/large/gm9.jpg')
->slideGallery('fred-gallery')
```
--------------------------------
### Gallery Grouping with slideGallery() in LightboxImageEntry
Source: https://context7.com/njxqlus/filament-lightbox/llms.txt
Illustrates how to group multiple images into separate galleries using the 'slideGallery()' method with LightboxImageEntry. This enables arrow key navigation between images within the same gallery, isolating them from other galleries on the page. Images not assigned to a specific gallery default to a single, combined gallery.
```php
use Njxqlus\Filament\Components\Infolists\LightboxImageEntry;
use Filament\Infolists\Infolist;
public static function infolist(Infolist $infolist):
Infolist
{
return $infolist
->schema([
// Product gallery - users can navigate between these 3 images
LightboxImageEntry::make('product_front')
->href('https://example.com/products/front.jpg')
->slideGallery('product-photos')
->label('Front View'),
LightboxImageEntry::make('product_side')
->href('https://example.com/products/side.jpg')
->slideGallery('product-photos')
->label('Side View'),
LightboxImageEntry::make('product_back')
->href('https://example.com/products/back.jpg')
->slideGallery('product-photos')
->label('Back View'),
// Separate gallery for certificates - isolated from product photos
LightboxImageEntry::make('certificate_quality')
->href('https://example.com/certs/quality.jpg')
->slideGallery('certificates')
->label('Quality Certificate'),
LightboxImageEntry::make('certificate_authenticity')
->href('https://example.com/certs/auth.jpg')
->slideGallery('certificates')
->label('Authenticity Certificate'),
// Without slideGallery() - defaults to 'gallery1' (all images navigable together)
LightboxImageEntry::make('company_logo')
->href('https://example.com/logo.jpg'),
]);
}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.