Laravel:无法从存储中检索图像

时间:2018-05-18 06:17:29

标签: laravel-5

我有一个将图像存储到存储/ 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',
    ],

1 个答案:

答案 0 :(得分:0)

/app

中删除asset('storage/app/images/'.$post->image)