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
|
@@ 173-183 (lines=11) @@
|
| 170 |
|
*/ |
| 171 |
|
public function image($server = '', $width = 200, $height = 200) |
| 172 |
|
{ |
| 173 |
|
return $this->as(function ($path) use ($server, $width, $height) { |
| 174 |
|
if (url()->isValidUrl($path)) { |
| 175 |
|
$src = $path; |
| 176 |
|
} elseif ($server) { |
| 177 |
|
$src = $server.$path; |
| 178 |
|
} else { |
| 179 |
|
$src = Storage::disk(config('admin.upload.disk'))->url($path); |
| 180 |
|
} |
| 181 |
|
|
| 182 |
|
return "<img src='$src' style='max-width:{$width}px;max-height:{$height}px' class='img' />"; |
| 183 |
|
}); |
| 184 |
|
} |
| 185 |
|
|
| 186 |
|
/** |