src/Grid/Displayers/Image.php 1 location
|
@@ 16-26 (lines=11) @@
|
| 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 = $server.$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 |
|
|
src/Show/Field.php 1 location
|
@@ 195-205 (lines=11) @@
|
| 192 |
|
*/ |
| 193 |
|
public function image($server = '', $width = 200, $height = 200) |
| 194 |
|
{ |
| 195 |
|
return $this->as(function ($path) use ($server, $width, $height) { |
| 196 |
|
if (url()->isValidUrl($path)) { |
| 197 |
|
$src = $path; |
| 198 |
|
} elseif ($server) { |
| 199 |
|
$src = $server.$path; |
| 200 |
|
} else { |
| 201 |
|
$src = Storage::disk(config('admin.upload.disk'))->url($path); |
| 202 |
|
} |
| 203 |
|
|
| 204 |
|
return "<img src='$src' style='max-width:{$width}px;max-height:{$height}px' class='img' />"; |
| 205 |
|
}); |
| 206 |
|
} |
| 207 |
|
|
| 208 |
|
/** |