By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,722 Members | 1,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,722 IT Pros & Developers. It's quick & easy.

print image in binary array to stdout

P: n/a
Hi folks,

I'm still having the problem that I don't know how I can print the data of a
jpeg image. I got the imagedata as return-value from a COM object.
The imagedata are hold in a Variant SafeArray of bytes.

Now I want to print the image header:
8<--------8<--------8<--------8<--------8<--------
header("Content-Type: image/jpeg")
8<--------8<--------8<--------8<--------8<--------

The php docs say, I should process these types in a foreach loop.
So I try:
8<--------8<--------8<--------8<--------8<--------
foreach ($imgDataArray as $byte) {
print decbin($byte);
}
8<--------8<--------8<--------8<--------8<--------

When I try this on the commanline, I get:
8<--------8<--------8<--------8<--------8<--------
Content-Type: image/jpeg

11111111110110001111111111100000010000100101010001 101001001100011001100101001111...etc.
8<--------8<--------8<--------8<--------8<--------

This means: No binary image output. :-((
But the data signature is absolutely correct. I controlled it against the
original jpg with a hex editor.

I also tried some other ideas, but no succes.
What am I doing wrong?

Many thanks in advance for every answer,
yours Henri

--
| Henri Schomäcker - BYTECONCEPTS, VIRTUAL HOMES
| * * Datendesign für Internet und Intranet
| * * * * http://www.byteconcepts.de
| * * * * http://www.virtual-homes.de
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Henri Schomaecker wrote:
foreach ($imgDataArray as $byte) {
print decbin($byte);
print chr($byte);
}

--
USENET would be a better place if everybody read:
http://www.expita.com/nomime.html
http://www.netmeister.org/news/learn2quote2.html
http://www.catb.org/~esr/faqs/smart-questions.html
Jul 17 '05 #2

P: n/a
Pedro Graca wrote:
Henri Schomaecker wrote:
foreach ($imgDataArray as $byte) {
print decbin($byte);


print chr($byte);
}



Yessss, many, many thanks for your fast and working answer!
Thank you very much,
yours Henri

--
| Henri Schomäcker - BYTECONCEPTS, VIRTUAL HOMES
| * * Datendesign für Internet und Intranet
| * * * * http://www.byteconcepts.de
| * * * * http://www.virtual-homes.de
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.