problem while trying to display image from database - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Monday, June 7, 2021

problem while trying to display image from database

I am trying to display a row from my database by id, the data displayed successfully but the image doesn't show (showing a broken link icon).

Here is the index.blade.php where the href to the row:

<a href="singlepost/">
<img src="storage/">

The route:

Route::get('/singlepost/{id}', 'App\http\controllers\TemplatesController@getPostById')->name('single.post');

The function getPostById

public function getPostById($id){
    $products = DB::table('templates')->where('id', $id)->first();

    return view('singlepost', compact('products'));
}

The singlepage.blade.php

<div class="row">
    <div class="col-lg-4">
        <img src="storage/">
    </div>
    <div class="col-lg-7">
        <h2></h2>
        <p></p>
    </div>
</div>


source https://stackoverflow.com/questions/67862840/problem-while-trying-to-display-image-from-database

No comments:

Post a Comment