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