473,513 Members | 2,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Jul 17 '05 #1
2 5552
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2594
by: Henri Schomäcker | last post by:
Hi folks, I got a windows com executable which returns a jpg image in a BSTR. Let's say, the var that holds the data is $imgData. With perl, in a cgi script, I may simpy write:...
19
2767
by: Karl Scalet | last post by:
Hi, quite often there is a need to just print out the items of a list. that would be nice, except prt() does not exist, and print is a statement not a function, hence cannot replace prt as...
4
2812
by: Mr. Costington | last post by:
Hi all, I was trying to hava a CGI script return an image, but it was coming back corrupted. So I tried this simple non-CGI test and still get errors: import sys image =...
1
1774
by: J. Kenney | last post by:
Good Morning, Is there a way for a function called within an _imported_ library to call back to _calling_ python program to run a function? (Shown below) Also can you overload the print...
4
4044
by: Anthony Liu | last post by:
There are many ways to represent a binary tree on an ascii screen. 1 / \ 2 3 / \ / \ 4 5 6 7 or
8
8545
by: Lucas | last post by:
I need print a file in binary mode . f = f.open('python.jpg','rb') bytes = f.read() f.close() print(bytes) I can't get any binary code.
2
3303
by: Roel | last post by:
Hi, I'm using the ASP.NET 2.0 profile system to keep an image of members of my website "MyWebsite". Initially, I've created the property in the web.config like: <add name="Photo"...
9
4202
by: loudking | last post by:
Dear all, I am writing a client-server application and the client should upload a file to the server, then the server should display the content of the file in stdout. Because I have to deal...
2
9767
by: ksheerasagar17 | last post by:
Hello All, Scenario: Sending an image through webservice as byte array to an Java webservice. The Problem1: The webservice method image property expects (data type) SByte rather than Byte...
0
7175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7553
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7120
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5697
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4754
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3247
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.