开发者

Generating Bitmap to - BLOB

开发者 https://www.devze.com 2023-03-13 09:42 出处:网络
Is it possible to generate a BLOB string of a bitmap image which using PHP ? ..im not telling about storing the BLOB in database .. i just required to directly generate a BMP -> BLOB 开发者_开发技巧Su

Is it possible to generate a BLOB string of a bitmap image which using PHP ? .. im not telling about storing the BLOB in database .. i just required to directly generate a BMP -> BLOB 开发者_开发技巧


Sure. If I understand correctly, you could just load up the image with file_get_contents() to grab its raw data. According to the linked docs, that function is binary-safe.

$bmpblob = file_get_contents('path/to/file.bmp');

To "print" its content to the user, you'd want to issue the correct type header before it. I think it would be something like this:

<?php
$bmpblob = file_get_contents('path/to/file.bmp');

header('Content-type: image/bmp');
echo $bmpblob;
0

精彩评论

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