首页 > 解决方案 > 图像未在 Laravel 8 视图中显示

问题描述

当我第一次这样做时它正在工作,然后突然停止工作。

这是我的URL

{{url('storage/profilepictures/'.Auth::user()->profilepicture )}}

我已经使用过这个命令

php artisan storage:link

标签: phplaravelurllaravel-8

解决方案


使用 fromasset代替URL

<img src="{{asset('/storage/profilepictures' .Auth::user()->profilepicture)}}" class="img-thumbnail" alt="Responsive image">

如果你想获得登录用户的照片,你可以得到它,如下所示:

 Auth::user()->profilepicture

或者:

auth()->user()->profilepicture

推荐阅读