Show Image in php that is saved in sql

0

Hello Friends very good morning I have the following situation, I have an image saved in sqlserver with a column type image.

I would like to be able to show it in php and I use the following code and I can not show it:

error_reporting(E_ALL);

$sql1 = "select top 1 l_resultgraf,l_id from Laboratorios where l_resultgraf is not null";
$stmt = sqlsrv_query($connLabcore, $sql1, array(), array( "Scrollable" => 'static' )) or die(print_r(sqlsrv_errors(), true));    

if ( sqlsrv_fetch( $stmt ) )
{
   $image = sqlsrv_get_field( $stmt, 0);
   //header("Content-Type: image/png");
   $image = base64_encode(pack('H*',$image));

    echo '<img width="100" height="100" src="data:image/jpg;base64,'. $image .'" />';
}

?>

Thanks in advance.

    
asked by Alexander J. Marcano 20.08.2018 в 17:45
source

0 answers