我有一个将图像存储到存储/ app / images
的功能 $filename = $image->getClientOriginalName();
if ($request->hasFile('image'))
{
$request->file('image')->storeAs('images', $filename);
}
$creator = new Content_form([
'media_id' => $request->get('media_name'),
'content_title' => $request->get('content_title'),
'content_description' => $request->get('content_description'),
'date_occured' =>\Carbon\Carbon::now()->format('Y-m-d'),
'page_number' => $request->get('page_number'),
'image' => $filename,
]);
$creator->save();
图像存储在数据库中,而存储/应用/图像只能在这里找不到那些图像是我的刀片
@foreach($pendingNews as $number=> $post)
<td style="font-size: 16px; width: 210px"><img class="img-rounded" width="150" height="130" src="{{ asset('storage/app/images/'.$post->image) }}"></td>
@endforeach
我还有文件系统
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'visibility' => 'public',
],
答案 0 :(得分:0)
从/app
asset('storage/app/images/'.$post->image)