Subject Re: [ib-support] Inserting GIF into database field
Author Martijn Tonies
Hi,

""junior"" <junior@...> wrote in message
news:00f801c11f19$770d0530$0601a8c0@w0006...
> Hi,
>
> How could I insert a GIF file into the database field? I tried to save
with:
>
> procedure TCSAppData.InsertImageIntoField(FieldName: TParam;
> Image: TImage);
> var
> TempStream: TMemoryStream;
> begin
> TempStream := TMemoryStream.Create;
> try
> Image.Picture.Graphic.SaveToStream(TempStream);
> TempStream.Position := 0;
> FieldName.LoadFromStream(TempStream, ftBlob);
> finally
> FreeAndNil(TempStream);
> end;
> end;
>
> But when I try to view the record with my app or IBConsole, then there
will be an exception saying:
>
> "Bitmap image is not valid";
>
> The above routine works fine for normal BMP file.

Indeed it does. Saving a BLOB works like this - however, a TDBImage (are you
using that?) cannot display anything else but BMP files. To work with GIF
images, load it yourself from the BLOB into a TImage component.


--
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."