This is a discussion on print image in binary array to stdout within the PHP Language forums, part of the PHP Programming Forums category; Hi folks, I'm still having the problem that I don't know how I can print the data of ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |