Subject Re: [ib-support] Inserting GIF into database field
Author Martijn Tonies
If you have a GIF image type registered as a valid graphic format
(TPicture.RegisterFileFormat), use a construction like this:

(Image is a TImage component, Query is an opened TQuery component)

TStream stream := Query.CreateBlobStream(myField, bmRead);
Image.Picture.Graphics.LoadFromStream(stream);

Look in the help of TQuery...

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



""junior"" <junior@...> wrote in message
news:004f01c11fcb$90cd99a0$0601a8c0@w0006...
> Thanks Martijn,
>
> I didn't use TIBImage, I use DevExpress DBGrid instead. However, that
error
> was a database error, which also occurs when I try to access the blob
field
> in IBConsole. If I am in the wrong direction, could you please tell me how
> do I load a blob into a normal TImage component?
>
> Thanks in advance.
>
> Best wishes,
> jr
>
> ----- Original Message -----
> From: "Martijn Tonies" <m.tonies@...>
> Newsgroups: egroups.ib-support
> To: <ib-support@yahoogroups.com>
> Sent: Wednesday, August 08, 2001 3:15 AM
> Subject: Re: [ib-support] Inserting GIF into database field
>
>
> > 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."
> >
> >
> >
> >
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > ib-support-unsubscribe@egroups.com
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >
> >
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>