Answer the question
In order to leave comments, you need to log in
How to display a picture, having its binary code?
Hello!
Using php, you need to display an image in the browser, the binary code of which is in the MSSQL table (field type image).
Binary code: "0xFFD8FFE000104A46494...."
jpg picture. Has anyone experienced this, please help.
Answer the question
In order to leave comments, you need to log in
header('Content-Type: image/jpeg;');
$data = 'бинарный код...';
$data = pack('H*',$data);
$im = imagecreatefromstring($data);
imagejpeg($im);
I kind of advised wrapping in base64:
<img src="data:image/jpeg;base64,<?php echo base64_encode($image); ?>" />
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question