show blob by base64 string in custom files

I’d like to ask,
I created a custom file and want to load the blob image in the html
but the result is: ���� JFIF ``���1�=��� xxxthe code I made is like this:

<?php
    $query = "SELECT * FROM employee"; 
    $stmt = ExecuteQuery($query); 
    $display = ""; 
    if ($stmt->rowCount() > 0) { 
        while ($row = $stmt->fetch()) { 
            $display .= $row["logo"]." <br>";  
        } 
        
        //var_dump($display);
        echo '<img src="data:image/jpeg;base64,'.base64_encode($display->load()) .'" />';     
    } else { 
        echo "   "; 
    } 
?>

Thank You

Rachman wrote:

while ($row = $stmt->fetch()) {
$display .= $row[“logo”]."
“;
}
echo ‘<img src="data:image/jpeg;base64,’.base64_encode($display->load()) .'”


  1. Your while loop concatenated all records into one single string, you should put your echo inside the loop.
  2. Your $display is a string, your should remove ->load().

thank you, very helpful. it works

I want to ask again,
I want to try to display a blob image in the listpage header using the page_dataRendering event, how to insert the PHP code, for example:Event Page_DataRendering :

//Example
$get_blob = ExecuteScalar("SELECT pic FROM employees");
<?php
echo "test"; error output
?>
$headers = "
<!--sample blob-->
         <div class='fadeIn animated mb-4'>
<div class='text-capitalize text-center'>
<img class='img-responsive' src='data:image/jpeg;base64,'.base64_encode($get_blob) .' ' width='200' height='150'>
                 <h2>BLOB File</h2>
</div>
         </div>
     ";

There is no need to include php tags inside server event, since it is already PHP code.

Rachman wrote:

$headers = "

BLOB File

";

You have wrong syntax. You cannot use the “.” to concat string inside a double quoted string like that. You may read PHP Strings and learn.

Thank You,
the code is running smoothlyecho ‘’;