【问题标题】:How to display image in my view blade from storage/app/public/student_img folder in laravel 8如何在 laravel 8 中的 storage/app/public/student_img 文件夹中的视图刀片中显示图像
【发布时间】:2022-01-09 17:29:52
【问题描述】:
I have stored the images inside the storage/app/public/student_img but am not able to fetch images using any method inside the blade.

my filesystem.php setting is
'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],
// this is the code

获取这样的图像 src='storage/app/student_img/{{ $stud->photo }}'

Please help me.

【问题讨论】:

    标签: image laravel-8 public app-folder


    【解决方案1】:

    你跑了吗:

    php artisan storage:link
    

    还没有?

    如果您在 /storage/app/public/student_img 有一个用于保存上传文件的文件夹,那么您需要在 /public 文件夹中放置指向该文件夹的符号链接。

    完成后,您可以使用以下方法在刀片模板中包含 /storage/app/public/student_img 文件夹中的图像:

    <img src="{{url('student_img/image.png')}}">
    

    【讨论】:

    • 是的,它在“ php artisan storage:link ”之后工作,然后asset('storage/student_img/'.$stud->photo) 感谢您的回答。对我很有帮助
    • 在这种情况下,请随时将其标记为已接受的答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-23
    • 2020-09-13
    • 2020-10-06
    • 1970-01-01
    • 2016-08-19
    • 2017-09-12
    • 1970-01-01
    相关资源
    最近更新 更多