Conditions | 4 |
Paths | 2 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
10 | public function display($server = '', $width = 200, $height = 200) |
||
11 | { |
||
12 | if ($this->value instanceof Arrayable) { |
||
13 | $this->value = $this->value->toArray(); |
||
14 | } |
||
15 | |||
16 | return collect((array) $this->value)->filter()->map(function ($path) use ($server, $width, $height) { |
||
17 | if (url()->isValidUrl($path)) { |
||
18 | $src = $path; |
||
19 | } elseif ($server) { |
||
20 | $src = rtrim($server, '/').'/'.ltrim($path, '/'); |
||
21 | } else { |
||
22 | $src = Storage::disk(config('admin.upload.disk'))->url($path); |
||
23 | } |
||
24 | |||
25 | return "<img src='$src' style='max-width:{$width}px;max-height:{$height}px' class='img img-thumbnail' />"; |
||
26 | })->implode(' '); |
||
27 | } |
||
28 | } |
||
29 |