【问题标题】:"Could not load image" in css background? laravel [duplicate]CSS背景中的“无法加载图像”? laravel [重复]
【发布时间】:2020-06-24 05:55:48
【问题描述】:

我已经用完了php artisan storage:link,但我不知道为什么它没有加载。当我检查它并将其悬停时,它会显示 “无法加载图像”,如下所示。

更让我困惑的是,当我点击链接时,链接实际上是有效的。

代码如下:

<div class="advertise p-2">
    <div class="ae-box" style="background: linear-gradient( rgba(34,34,34,0.78), rgba(34,34,34,0.78)), url('http://localhost/storage/ad1.gif') no-repeat;background-position-x: 0%, 0%;background-position-y: 0%, 0%;background-size: auto, auto;background-size: cover;background-position: center center;-webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;">
        <div class="ae-box-body text-center">
            <div class=""><i class="fa fa-certificate fa-3x"></i></div>
            <h4 class="m-0">Clifford Graham</h4>
            <p class="m-0">2 hours ago</p>
        </div>
    </div>
</div>

有人知道怎么做吗?

【问题讨论】:

  • 把你的控制器代码和这个问题放在一起
  • 访问http://localhost/storage/ad1.gif会得到什么?
  • @TalhaF。先生,您是什么意思?我把文件放在storage/public 里面我没有使用控制器来查看文件。这就是为什么我php artisan storage:link
  • 你的文件位置是什么,不是/storage/app/public吗?
  • @TalhaF。是的,链接有效,gif 显示。但是当我在 css-background 中尝试它时它没有出现

标签: php css laravel laravel-6


【解决方案1】:

找到答案了,因为我安装了adblocker。现在我禁用它后它可以工作了。

解决方案:How to display GIF's in laravel

【讨论】:

    【解决方案2】:

    我认为巨大的内联样式声明只是在要求一个错字。 我建议将所有这些都移到 CSS 样式文件中的 class 语句中,并逐个元素地构建它,直到你发现它全部出错...

    【讨论】:

    • 已经在css类中试过了。但不起作用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-11-14
    • 2015-04-16
    • 2020-02-13
    • 2021-04-20
    • 2014-02-17
    • 1970-01-01
    相关资源
    最近更新 更多