A
A
Alexfixer2020-03-08 11:06:18
Laravel
Alexfixer, 2020-03-08 11:06:18

Why is the output image not displayed in Laravel v5.8 with pagination?

The picture is in public/images/pictures here
Model:

class Crud extends Model
{
  protected $table = "sample_data";

    protected $fillable = [
     'first_name', 'last_name', 'image'
    ];

}

Controller:
public function index()
    {
        $data = Crud::latest()->paginate(5);
        return view('index', compact('data'))
                ->with('i', (request()->input('page', 1) - 1) * 5);
    }

View:
@foreach($data as $row)
  <tr>
   <td><img src="{{ URL::to('/') }}/images/{{ $row->image }}" class="img-thumbnail" width="75" /></td>
   <td>{{ $row->first_name }}</td>
   <td>{{ $row->last_name }}</td>
   <td>
    
   </td>
  </tr>
 @endforeach

Other fields are displayed...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Kokhan, 2020-03-08
@SkazochNick

Try this

<img src="{{ asset('images') }}/{{ $row->image }}" class="img-thumbnail" width="75" />

A
Alexfixer, 2020-03-08
@Alexfixer

The question disappeared, there were no names of pictures in the table

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question