Laravel:从存储文件夹中显示图像的问题

发布于 2025-01-27 23:50:53 字数 430 浏览 2 评论 0原文

我在查看图像中有一个问题,这是存储文件夹的图像,以下是代码:

->editColumn('image_path', function ($submission) {
                $imgUrl = asset('storage' . str_replace('public', '', $submission->image_path));
                return "<img src=\"{$imgUrl}\" alt=\"Gambar Barang\" width=\"250\" />";
            })

我尝试了 php手工艺品存储:link 它说链接已经存在,上次是图像正在显示,但是在删除了项目文件夹并粘贴了一个新图像后,图像没有显示。

I'm having a problem viewing image fron the storage folder, here are the codes:

->editColumn('image_path', function ($submission) {
                $imgUrl = asset('storage' . str_replace('public', '', $submission->image_path));
                return "<img src=\"{$imgUrl}\" alt=\"Gambar Barang\" width=\"250\" />";
            })

I tried php artisan storage:link it says the link already exists, last time the image was showing but after i deleted my project folder and pasted a new one the images doesn't showing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

听风吹 2025-02-03 23:50:53

Laravel生成该存储链接的缓存版本。

步骤1

删除root Directory上的public文件夹在root Directory上创建的存储文件夹

step 2

然后执行这些

php artisan optimize:clear
php artisan storage:link

命令终端的输出应为

The [public/storage] link has been connected to [storage/app/public].

Laravel generate cache version of that storage link..

Step 1

Delete the storage folder created by storage link command inside a public folder on your root directory

Step 2

Then execute these commands

php artisan optimize:clear
php artisan storage:link

The output on terminal should be

The [public/storage] link has been connected to [storage/app/public].
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文