BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to know blob content

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.databases
View previous topic :: View next topic  
Author Message
Phill
Guest





PostPosted: Thu Feb 05, 2004 11:13 am    Post subject: How to know blob content Reply with quote



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
Back to top
Dodgy
Guest





PostPosted: Thu Feb 05, 2004 11:43 am    Post subject: Re: How to know blob content Reply with quote



On 5 Feb 2004 03:13:14 -0800, [email]notyetguru (AT) yahoo (DOT) com[/email] (Phill) waffled on
about something:

Quote:
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

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

Back to top
Phill
Guest





PostPosted: Thu Feb 05, 2004 3:05 pm    Post subject: Re: How to know blob content Reply with quote



Thank you Dodgy!

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

Dodgy <Dodgy (AT) earth (DOT) planet.universe> wrote

Quote:
On 5 Feb 2004 03:13:14 -0800, [email]notyetguru (AT) yahoo (DOT) com[/email] (Phill) waffled on
about something:

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

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.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.