@@ -28,7 +28,7 @@ public function zooming()
2828 'zoom ' => [
2929 'enabled ' => true ,
3030 'duration ' => 300 ,
31- 'easing ' => 'ease-in-out ' ,
31+ 'easing ' => 'ease-in-out ' ,
3232 ]
3333 ]);
3434 }
@@ -39,6 +39,10 @@ public function display(array $options = [])
3939 return '' ;
4040 }
4141
42+ if ($ this ->value instanceof Arrayable) {
43+ $ this ->value = $ this ->value ->toArray ();
44+ }
45+
4246 $ server = array_get ($ options , 'server ' );
4347 $ width = array_get ($ options , 'width ' , 200 );
4448 $ height = array_get ($ options , 'height ' , 200 );
@@ -49,18 +53,20 @@ public function display(array $options = [])
4953
5054 Admin::script ($ this ->script ());
5155
52- if (url ()->isValidUrl ($ this ->value )) {
53- $ src = $ this ->value ;
54- } elseif ($ server ) {
55- $ src = rtrim ($ server , '/ ' ) . '/ ' . ltrim ($ this ->value , '/ ' );
56- } else {
57- $ src = Storage::disk (config ('admin.upload.disk ' ))->url ($ this ->value );
58- }
56+ return collect ((array )$ this ->value )->filter ()->map (function ($ path ) use ($ server , $ width , $ height ) {
57+ if (url ()->isValidUrl ($ path ) || strpos ($ path , 'data:image ' ) === 0 ) {
58+ $ src = $ path ;
59+ } elseif ($ server ) {
60+ $ src = rtrim ($ server , '/ ' ) . '/ ' . ltrim ($ path , '/ ' );
61+ } else {
62+ $ src = Storage::disk (config ('admin.upload.disk ' ))->url ($ path );
63+ }
5964
60- return <<<HTML
65+ return <<<HTML
6166<a href=" $ src" class="grid-popup-link">
6267 <img src=' $ src' style='max-width: {$ width }px;max-height: {$ height }px' class='img img-thumbnail' />
6368</a>
6469HTML ;
70+ })->implode (' ' );
6571 }
66- }
72+ }
0 commit comments