Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to know blob content

7 views
Skip to first unread message

Phill

unread,
Feb 5, 2004, 6:13:14 AM2/5/04
to
Hi folks!

Could you help me?
I have a blob filed in an Oracle database.
Here it can be stored images (bmp, jpg, gif).
I want to make it possible to preview those images in a TImage control.
I can display any image, but only if I know it's file type. How could I test
the filetype of the image? I'll use an AfterScroll event, but I must know what
format is there so I could execute the display statement for that file type.


Thank you,
Eugen

Dodgy

unread,
Feb 5, 2004, 6:43:02 AM2/5/04
to
On 5 Feb 2004 03:13:14 -0800, notye...@yahoo.com (Phill) waffled on
about something:

Two methods...

1) Add a database field to indicate the different types.

2) Check the header information at the start of the Blob data.

A Jpeg will contain "JFIF" Starting 6 chars in from the start...
A BMP will start "BM" from offset 0
A GIF will start "GIF" from offset 0

Full specs of the files can be found via http://www.wotsit.org/

So basically you'll need to read the blob field into a memory stream
or something like that, then check the beginning of the data before
feeding that stream into your image routine.

Hope this helps,

Dodgy.
--
MUSHROOMS ARE THE OPIATE OF THE MOOSES

Phill

unread,
Feb 5, 2004, 10:05:41 AM2/5/04
to
Thank you Dodgy!

It works perfect. I've chosed the second method, because I didn't want
another field in the database.

Dodgy <Do...@earth.planet.universe> wrote in message news:<ola420hph0d83r9jv...@4ax.com>...

0 new messages