如何显示存储在路径正常的 public 文件夹中的图像?
How to display image that is stored in public folder whose path is working fine?
我正在尝试显示存储在我的 public 文件夹中的图像。当我只使用 {{$post-> image}} 时显示我的图像的路径但是当我 运行 以下命令时我无法显示图像。
@foreach($posts -> $post)
<tr>
<td> <img src="{{ asset($post->image) }}" alt=""></td>
<td> {{ $post-> title }} </td>
</tr>
@endforeach
根据你的图片,你调用的唯一路径是 public/posts/picture.jpg 但根据你的图片,你需要调用 public/storage/posts/picture.jpg 所以你需要
{{asset('storage/posts/picture.jpg')}}
我正在尝试显示存储在我的 public 文件夹中的图像。当我只使用 {{$post-> image}} 时显示我的图像的路径但是当我 运行 以下命令时我无法显示图像。
@foreach($posts -> $post)
<tr>
<td> <img src="{{ asset($post->image) }}" alt=""></td>
<td> {{ $post-> title }} </td>
</tr>
@endforeach
根据你的图片,你调用的唯一路径是 public/posts/picture.jpg 但根据你的图片,你需要调用 public/storage/posts/picture.jpg 所以你需要
{{asset('storage/posts/picture.jpg')}}