I have an image file saved in a MSSQL DB and I’m trying to display it using PHP. I’ve googled around for a few days now and have found plenty of other threads on this topic, but none of them seem to be working for me. The datatype of the column holding the data itself is of type “image”.
I have the it working in ASP fine with this code:
[CODE]
// rs is the Result Set of the query
attachment = rs(“data”).GetChunk(10485760)
Response.ContentType = rs(“type_”) // ‘image/jpg’
Response.BinaryWrite attachment
I’m attempting to do the same thing in PHP with this code, but it doesn’t seem to be working:
[CODE]
$type = $rs->Fields[‘type_’]->Value;
$data = $rs->Fields[‘data’]->GetChunk(10485760);
header(“Content-Type: $type”); // ‘image/jpg’
echo $data;
I’ve tried probably 30+ combinations of base64_encode/decode/imagejpg()/etc.. and still can’t get this.