dimanche 31 mars 2019

How to display blob from database in html tag

I am trying to display blob images from the database. When I try using HTML fragment embedding it show, but if I try using PHP it doesn't show anything.

Database:

DATABASE

I tried using the embedded strings it shows but its not coming from the database.

But when I try this code to make it display from the database it doesn't show anything.

@foreach($data as $value)

    <?php
    header("Content-Type: image/png");
    $db = mysqli_connect("127.0.0.1","root","xxxx","xxxx"); 
    $sql = "SELECT * FROM custom"; 
    $statement = $db->query($sql);
    $result = mysqli_fetch_array($statement);
    echo '<img src="data:image/png;base64,'.base64_encode($result['img_front'] ).'"/>';
    ?>

@endforeach

I want to dynamically display each blob image from the database on my web like this.

What i want to display from the database foreach blob:

what i want to display from the database foreach blob



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire