简体   繁体   English

Laravel 7 存储映像未加载

[英]Laravel 7 Storage Image not loading

I have created new Laravel project as per their documentation I have applied this command我根据他们的文档创建了新的 Laravel 项目我已经应用了这个命令

php artisan storage:link

This creates a symbolic link to 'storage/app/public' directory in 'public/storage'这会在'public/storage'中创建一个指向'storage/app/public'目录的符号链接

I have placed images in this folder in 'images' and my actual path is 'storage/app/public/images' but my symbolic link path is我已将图像放在此文件夹中'images'中,我的实际路径是'storage/app/public/images' ,但我的符号链接路径是

'public/storage'

now I have placed bellow image tag in welcome.blade.php现在我在welcome.blade.php中放置了波纹管图像标签

<img src="{{ asset('storage/images/banner_1_en.jpg') }}" alt="testing">

but image is not showing.但图像未显示。

I am new to Laravel and trying to learn我是 Laravel 的新手并尝试学习

  1. what I am doing wrong?我做错了什么?
  2. is this a safe way or place to store and show images on web?这是在 web 上存储和显示图像的安全方式或场所吗?

Thanks so much非常感谢

the helper asset is for assets in the public folder, for the storage, you must use the class Storage, and its method url辅助asset是针对公用文件夹中的资产,对于存储,您必须使用 class 存储,其方法url

Try this:尝试这个:

<img src="{{ Storage::url('images/banner_1_en.jpg') }}" alt="testing">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM