开发者

How to display MSSQL varbinary(3072) image in PHP?

I have an bitmap image stored in MSSQL, datatype of the column is varbinary(3072). All I want to do with the image in PHP is to display it + store it into a file. How to do that?

Couldn't find anything useful on Google nor here on SO. Only thing I have found is usage of some framework - that's not what I want.

Here is an example image:

0x444453207C000000071008001000000010000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000040000004458543100000000000000000000000000000000000000000000000000000000000000000000000000000开发者_Go百科0001B021A02555555551B021A02555555551B021A02555555551B021A02555555559DBFA7110D3FD555FFFF115E02080F05FEDF4E03C0A0E070555DE819635EFAC3F69DE609DC706BEFFCBFA4010B0BADDDFBC74F4458B808A8B475271A60ACA67757AFA9335F7E5456ED3345091BA280A058972C3BE063E9F5104D683A55FD8383


Well, here is the answer (thx NullUserException ఠ_ఠ):

header('Content-Type: image/bmp');
$h2 = '424D36030000000000003600000028000000100000001000000001001800000000000003000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA0D2FD3BA5FC39A9FC4BABFC77BDFD50ADFC38A5FC37A5FC4DACFC87C6FDE3F2FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDBEEFE39A3FC4CCDFE56D7FE3FC0FD57D8FE61E3FF61E3FF59DAFE3DBDFD289DFBABD7FEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF91CAFD2BAAFC6CEFFF6BEDFF46C4E83AB6E13AB6E140BDE46CEEFF59DBFE209EFCACD7FEFFFFFFFFFFFFFFFFFFEBF6FF30A0FB55D6FE63E5FC28A2D528A2D539B6E139B6E11C94CD1287C565E7FC5ADBFE249AFBE5F3FFFFFFFFFFFFFF93CBFD3ABAFD6CEEFF28A2D555D5F466E8FF66E8FF66E8FF66E8FF49C8EC1C94CD6CEEFF3DBDFD86C5FDFFFFFFFFFFFF52AEFC55D6FE69ECFF66E8FF66E8FF66E8FF66E8FF66E8FF66E8FF66E8FF44C2E869EBFF58DAFE4BABFCFFFFFFFFFFFF37A4FC5FE1FF68EAFF8CEEFFD9F9FFBCF5FF66E8FF66E8FFBCF5FFD9F9FF8CEEFF67E9FF62E3FF35A4FBFFFFFFFFFFFF36A3FC5FE1FF7AEDFFFFFFFF6F6F6F5F5F5F9FF1FF9FF1FF6F6F6F4F4F4FFFFFFF79ECFF61E3FF36A5FBFFFFFFFFFFFF54AFFC54D5FE85F0FFFFFFFF0F0F0F000000A9F2FFA9F2FF0F0F0F000000EFEFEF85EFFF58D9FE4CACFCFFFFFFFFFFFF97CDFD38B8FD6CEEFFF5FEFF9F9F9F9F9F9F82ECFF82ECFF9F9F9F8F8F8FF5FEFF6CEEFF3BBBFD8AC7FDFFFFFFFFFFFFEDF7FF2B9CFB50C9EF6CB5BFACE5EFB2F3FF66E8FF66E8FF95EFFFB2F3FF86F1FF58D9FE269AFBE8F4FFFFFFFFFFFFFFFFFFFFBBDFFE1C7FCD0000000E1E2049A3B068EAFF5BCEE050B2C03D87901029301B80CEB5DCFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBADEFE165A951C5C7F35869F59D4F0429BB015364019526F135286B2DAFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFECF6FF98CDFD57B0FC38A4FC37A4FC55AFFC93CBFDEAF5FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';
$s = pack('H*', strtolower($h2));
echo $s;

The only problem is that the image I posted seems to be in some strange format.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜