print image in binary array to stdout

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-21-2004
Henri Schomaecker
 
Posts: n/a
Default print image in binary array to stdout

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
Reply With Quote
  #2 (permalink)  
Old 10-21-2004
Pedro Graca
 
Posts: n/a
Default Re: print image in binary array to stdout

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
Reply With Quote
  #3 (permalink)  
Old 10-22-2004
Henri Schomaecker
 
Posts: n/a
Default Re: print image in binary array to stdout

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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:21 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0