Laravel管理映像URL不包括端口,导致在编辑表单中找不到映像

问题描述 投票:1回答:1

当我将新图像上传到身份模型时,它可以显示预览。但是,当我对其进行编辑时,env(APP_URL)的端口未包含图像URLlaravel admin form edit

我签入目录,并且图像实际上在那里。image in directory

但是,仍然可以通过以下代码在我的主页上访问它:

<img src="{{asset('uploads/'.$identity->picture_path)}}" alt="">

及其在浏览器中返回的内容:

<img src="http://localhost:8000/uploads/images/5d263cb580b1d800119a5211bc759fde.jpg" alt="">

这是我的config / filesystems.phpconfig/filesystems.php

php laravel
1个回答
0
投票

尝试。

@php $image = url('uploads/'.$identity->picture_path); @endphp
<img src="{{ $image }}" alt="" width="auto" height="150px">

或者如果文件存储在公用文件夹中

@php $image = url('public/uploads/'.$identity->picture_path); @endphp
<img src="{{ $image }}" alt="" width="auto" height="150px">
© www.soinside.com 2019 - 2024. All rights reserved.