From: koterski@NOSPAMgte.net (Steve Koterski) Subject: Re: How to display a GIF type field in TDBImage Date: 28 Jun 1999 00:00:00 GMT Message-ID: <377dadfb.7146744@news.gte.net> Distribution: world Content-Transfer-Encoding: 7bit References: <7l5gib$pdh$1@nnrp1.deja.com> Content-Type: text/plain; charset=us-ascii X-Abuse-Info: Otherwise we will be unable to process your complaint properly X-Complaints-To: abuse@gte.net X-Trace: +rvUKl7oJLsxIVV7Ep/9CrclaAw+m4NQy676Um2i5B0fiYIumYb4B+7MQvUR8RRRnY3supXEjOgY!La+pTajjWAyUmXpiHxEbzFxZ6HhWbwV155tVAoZ7YqgchlLwDAOz/ztbZA== Organization: GTE Internet Solutions MIME-Version: 1.0 NNTP-Posting-Date: Mon, 28 Jun 1999 17:47:11 GMT Reply-To: koterski@NOSPAMgte.net Newsgroups: comp.lang.pascal.delphi.databases On Sun, 27 Jun 1999 15:38:52 GMT, ammar_aganovic@my-deja.com wrote: >The subject should say it. >It is a web based DB so it is filled with .gifs & .jpgs, but TDBImage >reads .bmps by default. Is there a way to tell the TDBImage how to >handle other formats? Do I have to stream? The TDBImage component is predicated on graphics formats native to Windows, like bitmap. GIF and JPEG are not native to the Windows environment. For JPEG data, use a TJPEGImage component. For GIF images, though, you would need a third-party component. As TJPEGImage is not data-aware, you would need to copy the data from BLOB column to component each time the dataset component's record pointer moves. This is signified by the AfterScroll event. For example: procedure TForm1.Table1AfterScroll(DataSet: TDataSet); var MS: TMemoryStream; J1: TJPEGImage; begin J1 := TJPEGImage.Create; MS := TMemoryStream.Create; try TBlobField(DataSet.Fields[1]).SaveToStream(MS); MS.Seek(soFromBeginning, 0); with J1 do begin PixelFormat := jf24Bit; Scale := jsFullSize; Grayscale := False; Performance := jpBestQuality; ProgressiveDisplay := True; ProgressiveEncoding := True; LoadFromStream(MS); end; Image1.Picture.Graphic.Assign(J1); finally J1.Free; MS.Free; end; end; _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ Steve Koterski "An inventor is a person who makes an ingenious Felton, CA arrangement of wheels, levers and springs, and believes it civilization." -- Ernest Dimnet (1866-1954)