Content Display

Gallery Widget

Feature Docs

Display images and videos in beautiful layouts with lightbox support. Supports grid, masonry, carousel, and lightbox-only layouts. Includes lazy loading, aspect ratio control, and video playback.

Grid Layout

Responsive grid with equal-height images.

Code
<?php echo GalleryWidget::widget([ 'images' => ['/img/1.jpg', '/img/2.jpg', '/img/3.jpg'], 'layout' => 'grid', 'columns' => 4, 'lightboxEnabled' => true, ]); ?>
Live Demo

Masonry Layout

Pinterest-style masonry grid with natural heights.

Code
<?php echo GalleryWidget::widget([ 'images' => [...], 'layout' => 'masonry', 'columns' => 3, ]); ?>
Live Demo

Carousel

Bootstrap carousel with automatic slideshow.

Code
<?php echo GalleryWidget::widget([ 'images' => [...], 'layout' => 'carousel', 'autoplay' => true, ]); ?>
Live Demo

Lightbox with Captions

Thumbnail grid with captions and lightbox.

Code
<?php echo GalleryWidget::widget([ 'images' => [ ['url' => '/img/1.jpg', 'caption' => 'Caption 1'], ['url' => '/img/2.jpg', 'caption' => 'Caption 2'], ], 'layout' => 'lightbox', 'showCaptions' => true, ]); ?>
Live Demo

Configuration Options

OptionTypeDefaultDescription
imagesarraynullArray of image URLs or data arrays
fileIdsarraynullArray of File model IDs
entityTypestringnullEntity type for EntityAttachment lookup
entityIdintnullEntity ID for attachments
gallerySlugstringnullGallery album slug
layoutstringgridLayout: grid, masonry, carousel, lightbox
columnsint4Number of columns (2-6)
aspectRatiostring4:3Aspect ratio: 1:1, 4:3, 16:9, 3:2, auto
lightboxEnabledbooltrueEnable lightbox on click
showCaptionsboolfalseShow image captions
lazyLoadbooltrueEnable lazy loading