skip to Main Content

I want to display image from database to background-image css property inside carousel slider. But cannot make it work. Its blank.

My code:

<div class="ec-slide-item d-flex slide-10" style="background-image: url({{env('APP_URL')}}.'/'.{{$product->image}});">

The value of $product->image is ‘assets/images/dgfgsgs.jpg’.
The whole url is correct. But still not working. Help.

2

Answers


  1. just try:

     <div class="ec-slide-item d-flex slide-10" style="background-image: url('{{ asset($product->image) }}');">
    

    instead the variable $product->image should return a result like this: ‘images/dgfgsgs.jpg’

    Login or Signup to reply.
  2. try this

    <div class="ec-slide-item d-flex slide-10" style="background-image: url({{ asset($product->image ) }})">
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search