From 86b30483132548ac45c4a2dc749ffb513af19c99 Mon Sep 17 00:00:00 2001 From: jxlwqq Date: Thu, 7 Mar 2019 14:57:43 +0800 Subject: [PATCH 1/2] add img class. --- src/LightboxDisplayer.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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(' '); From d8c1b882ef8c3dc1b7e85a00b7b7085d8ee8544b Mon Sep 17 00:00:00 2001 From: jxlwqq Date: Thu, 7 Mar 2019 15:00:17 +0800 Subject: [PATCH 2/2] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) 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