如何解决存储链接中的Laravel图片已损坏
在laravel中,我使用php artisan创建了存储,我无法在刀片上传时访问我的图像,但效果很好,但我什至看不到它们损坏的文件。即使在使用http://localhost:8000/storage/ProductId-1601294060.jpg
时也未找到laravel响应,但文件夹中存在图像
我尝试过的步骤
<td><strong><img src="/storage/product_image/ProductId-1601296148.jpg" height="150px" width="150px"/></strong></td>
第2步
<td> <img src="{{ URL::asset('/storage/product_image/ProductId-1601296148.jpg') }}" ></a></td>
第3步
<td><img src="{{asset('/storage/product_image/ProductId-1601296148.jpg')}}" class="img-size-50 mr-3 img-circle"></td>
也在我添加的文件配置文件系统中
'default' => 'public'
谢谢
解决方法
请尝试在公共文件夹中创建符号链接,然后您将可以访问图像 您可以阅读更多here
php artisan storage:link
,
我认为您的问题是您使用的是asset(/storage..)
而不是asset('storage...)
Laravel存储文件系统是如此独特。当您进行任何上传时,它将上传到storage / app / public目录中。要使其在公共目录中可访问,需要做的是通过运行命令创建符号链接:
php artisan storage:link
或
<img src="{{ Storage::url("/product_image/ProductId-1601296148.jpg") }}" alt="" />
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。