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

""junior"" <junior@...> wrote in message
> Hi,
> How could I insert a GIF file into the database field? I tried to save
> 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

Upscene Productions

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