Skip to content

Commit 86b3048

Browse files
authored
add img class.
1 parent b4b2e4e commit 86b3048

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/LightboxDisplayer.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,18 @@ public function display(array $options = [])
4646
$server = array_get($options, 'server');
4747
$width = array_get($options, 'width', 200);
4848
$height = array_get($options, 'height', 200);
49+
$class = array_get($options, 'class', 'thumbnail');
50+
$class = collect((array)$class)->map(function ($item) {
51+
return 'img-'. $item;
52+
})->implode(' ');
4953

5054
if (array_get($options, 'zooming')) {
5155
$this->zooming();
5256
}
5357

5458
Admin::script($this->script());
5559

56-
return collect((array)$this->value)->filter()->map(function ($path) use ($server, $width, $height) {
60+
return collect((array)$this->value)->filter()->map(function ($path) use ($server, $width, $height, $class) {
5761
if (url()->isValidUrl($path) || strpos($path, 'data:image') === 0) {
5862
$src = $path;
5963
} elseif ($server) {
@@ -64,7 +68,7 @@ public function display(array $options = [])
6468

6569
return <<<HTML
6670
<a href="$src" class="grid-popup-link">
67-
<img src='$src' style='max-width:{$width}px;max-height:{$height}px' class='img img-thumbnail' />
71+
<img src='$src' style='max-width:{$width}px;max-height:{$height}px' class='img {$class}' />
6872
</a>
6973
HTML;
7074
})->implode('&nbsp;');

0 commit comments

Comments
 (0)