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

Read OLE Object field to Image ?

P: n/a
I have a simple problem:
I have an Access database (images.mdb) that has 2 columns: one is the id if
the picture (an integer) and one (column named picture) is a field of type
OLE Object which contains an image (it can store jpg, bmp, gif, but I don't
know what image is stored inside).
I want to retrieve the picture stored in the database and identified by a
given id and display it in a web page (.aspx).
I write in Visual C#, but it does not matter, VB answers are just as
wellcome.
My problem is that this OLE Object field does not contain just the raw array
of bytes that form the image. So I can not just read the array of bytes and
output it to the browser.
no, it contains some extra information about the type of the file stored
(which would be good to know so I can know what kind of image it is). but I
don't know how to get this information.
I also don't know how to separate this information from the actual image.
Does anyone know how to solve this ?

Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
> I have a simple problem:

LOL

The following MS Knowledge Base article should help:

http://support.microsoft.com/default...57&Product=acc

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Sandi" <sa***@nomail.ro> wrote in message
news:u9**************@TK2MSFTNGP12.phx.gbl...
I have a simple problem:
I have an Access database (images.mdb) that has 2 columns: one is the id if the picture (an integer) and one (column named picture) is a field of type
OLE Object which contains an image (it can store jpg, bmp, gif, but I don't know what image is stored inside).
I want to retrieve the picture stored in the database and identified by a
given id and display it in a web page (.aspx).
I write in Visual C#, but it does not matter, VB answers are just as
wellcome.
My problem is that this OLE Object field does not contain just the raw array of bytes that form the image. So I can not just read the array of bytes and output it to the browser.
no, it contains some extra information about the type of the file stored
(which would be good to know so I can know what kind of image it is). but I don't know how to get this information.
I also don't know how to separate this information from the actual image.
Does anyone know how to solve this ?

Nov 17 '05 #2

P: n/a
I would like to thank you for your help.
But my problem reffers to something else.
I have no problem in reading the db field where the image is stored as an
OLE object.
I read it ok and I obtain an array of bytes.
BUT. This array of bytes that I read is NOT the actual image!
The problem si that the byte array is made of a header (of variable length)
that is added by Access and then it is continued with the actual image
information.
This is the way an OLE Object is stored. this is the way Access stores
images - as OLE Objects that are different from the actual image (the image
is preceded by a header).
So:
- does anyone know how I can parse this byte array into header + image (so I
can obtain the image) - the header seems to be of variable lenghth...
- or... is there any component (control) that I can use from Visual Studio
that can read the OLE Object (the byte array) and return me the image that
is wrapped inside the OLE Object ?


"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:e1**************@TK2MSFTNGP10.phx.gbl...
I have a simple problem:
LOL

The following MS Knowledge Base article should help:

http://support.microsoft.com/default...57&Product=acc

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Sandi" <sa***@nomail.ro> wrote in message
news:u9**************@TK2MSFTNGP12.phx.gbl...
I have a simple problem:
I have an Access database (images.mdb) that has 2 columns: one is the id

if
the picture (an integer) and one (column named picture) is a field of type OLE Object which contains an image (it can store jpg, bmp, gif, but I

don't
know what image is stored inside).
I want to retrieve the picture stored in the database and identified by a given id and display it in a web page (.aspx).
I write in Visual C#, but it does not matter, VB answers are just as
wellcome.
My problem is that this OLE Object field does not contain just the raw

array
of bytes that form the image. So I can not just read the array of bytes

and
output it to the browser.
no, it contains some extra information about the type of the file stored
(which would be good to know so I can know what kind of image it is). but I
don't know how to get this information.
I also don't know how to separate this information from the actual

image. Does anyone know how to solve this ?


Nov 17 '05 #3

P: n/a
Hi Sandi,

Sorry about that. I didn't look closely enoough at the article. I have seen
this before, and thought that the article I pointed to described this, but I
was mistaken. Check out the following article instead, which should have
enough information for you to parse out the header:

http://support.microsoft.com/default...NoWebContent=1

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Sandi" <Sa***@neomail.ro> wrote in message
news:O$**************@tk2msftngp13.phx.gbl...
I would like to thank you for your help.
But my problem reffers to something else.
I have no problem in reading the db field where the image is stored as an
OLE object.
I read it ok and I obtain an array of bytes.
BUT. This array of bytes that I read is NOT the actual image!
The problem si that the byte array is made of a header (of variable length) that is added by Access and then it is continued with the actual image
information.
This is the way an OLE Object is stored. this is the way Access stores
images - as OLE Objects that are different from the actual image (the image is preceded by a header).
So:
- does anyone know how I can parse this byte array into header + image (so I can obtain the image) - the header seems to be of variable lenghth...
- or... is there any component (control) that I can use from Visual Studio
that can read the OLE Object (the byte array) and return me the image that
is wrapped inside the OLE Object ?


"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:e1**************@TK2MSFTNGP10.phx.gbl...
I have a simple problem:
LOL

The following MS Knowledge Base article should help:

http://support.microsoft.com/default...57&Product=acc

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Sandi" <sa***@nomail.ro> wrote in message
news:u9**************@TK2MSFTNGP12.phx.gbl...
I have a simple problem:
I have an Access database (images.mdb) that has 2 columns: one is the id
if
the picture (an integer) and one (column named picture) is a field of type OLE Object which contains an image (it can store jpg, bmp, gif, but I

don't
know what image is stored inside).
I want to retrieve the picture stored in the database and identified
by a given id and display it in a web page (.aspx).
I write in Visual C#, but it does not matter, VB answers are just as
wellcome.
My problem is that this OLE Object field does not contain just the raw

array
of bytes that form the image. So I can not just read the array of
bytes and
output it to the browser.
no, it contains some extra information about the type of the file

stored (which would be good to know so I can know what kind of image it is).

but
I
don't know how to get this information.
I also don't know how to separate this information from the actual

image. Does anyone know how to solve this ?



Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.