Reputation: 16224
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
Upvotes: 0
Views: 740
Reputation: 20873
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;
Upvotes: 3