在Laravel localhost上加载图像不起作用

问题描述 投票:0回答:1

当尝试在laravel上加载我的图像时,图像以后端精细加载。但没有在网页上显示。

这是我的代码:

<figure class="c-card__image c-card__image--arrow c-searchresult__image"style="background-image: url('{{$image}}?{{\Carbon\Carbon::now()->timestamp}}')"></figure>

这是浏览器中的代码:

<figure class="c-card__image c-card__image--arrow c-searchresult__image" style="background-image: url('/vendors/57/horse-11.png?1554287941')"></figure>

在我的控制台和网络选项卡(从浏览器)我可以看到图像正确加载..但它没有显示在屏幕上..

html css laravel background-image
1个回答
0
投票

在上面的代码中,你没有指定任何可能是问题的文件类型,它应该像这样的horse-11.png?1554287941.pnghorse-11?1554287941.png.Your $image var应该只保存名称,这样你可以做这样的事情:

<figure class="c-card__image c-card__image--arrow c-searchresult__image"style="background-image: url('{{$image}}?{{\Carbon\Carbon::now()->timestamp}}'.'png')"></figure>

输出将是这样的

<figure class="c-card__image c-card__image--arrow c-searchresult__image" style="background-image: url('/vendors/57/horse-11?1554287941.png')"></figure>
© www.soinside.com 2019 - 2024. All rights reserved.