如何显示保存在 public 图像目录 laravel 中的数据库中的图像

how to show images back from database that are saved in public images directory laravel

我坚持了一段时间,现在明显遗漏了一些东西,但目前找不到它i am trying to retrieve the images by the loop 我正在尝试通过循环检索图像

这是保存它的代码,运行良好。 [保存图像的代码]

这是我尝试把它弄出来时得到的结果 404 error upon retriveing image

我猜你的图片路径是public/images/404.png 使用 asseturl

<img src="{{$tour->photo->file ? asset('images/'.$tour->photo->file): asset('images/404.png')}}">

<img src="{{$tour->photo->file ? url('images/'.$tour->photo->file): url('images/404.png')}}">