简体   繁体   English

视图不显示 Laravel 中存储的图像

[英]View doesn't show the image on storage in Laravel

I'm trying to show all images on my storage/app/livros folder on a view with this code below, but I get this我正在尝试使用下面的代码在视图中显示我的 storage/app/livros 文件夹中的所有图像,但我得到了这个就像我那里什么都没有 . . How can I show these images?我怎样才能显示这些图像?

@extends('layouts.app_cad_livros')
@section('content')
    <div class="textocs">
        <br>
        <h3>LIVROS</h3>
    </div>
    <div class="card_livro">
        @foreach($livro as $mostra)
            {{$mostra->users_id}}

            <img src="{{ url("storage/app/livros{$mostra->image}") }}"
                 style="max-width=100px;">

            TÍTULO   {{$mostra->namel}}<br>
            AUTOR {{$mostra->autor}}<br>
            EDITORA {{$mostra->editora}}<br>
            CATEGORIA {{$mostra->categoria}}<br>
            CLASSIFICAÇÃO {{$mostra->classificação}}<br>
            DESCRIÇÃO {{$mostra->descricao}}<br>
            CAPA {{$mostra->image}}<br>
        @endforeach
    </div>
    <a href="{{ url('/alugar', $mostra->users_id)}}">
        <button class="btn btn-primary">quero alugar</button>
    </a>
@endsection

this is the这是

<img src="{{ url("storage/{$mostra->image}") }}"  style="max-width=100px;">

You need to run the command:您需要运行以下命令:

php artisan storage:link

and to access the image:并访问图像:

 asset('storage/app/path/to/image')

try this试试这个

asset('storage/app/livros/'.$mostra->image.')

or要么

asset('storage/app/livros/{$mostra->image}')

You can get more info From Here您可以从这里获取更多信息

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

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