diff --git a/README.md b/README.md index 79ac824..add0c57 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,10 @@ $grid->picture()->gallery(['zooming' => true]); //width & height properties $grid->picture()->lightbox(['width' => 50, 'height' => 50]); $grid->picture()->gallery(['width' => 50, 'height' => 50]); + +//img class properties +$grid->picture()->lightbox(['class' => 'rounded']); +$grid->picture()->gallery(['class' => ['circle', 'thumbnail']]); ``` ## Donate diff --git a/src/LightboxDisplayer.php b/src/LightboxDisplayer.php index 8c0f0b9..c18b405 100644 --- a/src/LightboxDisplayer.php +++ b/src/LightboxDisplayer.php @@ -46,6 +46,10 @@ public function display(array $options = []) $server = array_get($options, 'server'); $width = array_get($options, 'width', 200); $height = array_get($options, 'height', 200); + $class = array_get($options, 'class', 'thumbnail'); + $class = collect((array)$class)->map(function ($item) { + return 'img-'. $item; + })->implode(' '); if (array_get($options, 'zooming')) { $this->zooming(); @@ -53,7 +57,7 @@ public function display(array $options = []) Admin::script($this->script()); - return collect((array)$this->value)->filter()->map(function ($path) use ($server, $width, $height) { + return collect((array)$this->value)->filter()->map(function ($path) use ($server, $width, $height, $class) { if (url()->isValidUrl($path) || strpos($path, 'data:image') === 0) { $src = $path; } elseif ($server) { @@ -64,7 +68,7 @@ public function display(array $options = []) return << - + HTML; })->implode(' ');