Re: Saving Image/Picture to Database using ADO
- From: Brian Bushay TeamB <BBushay@xxxxxxxxx>
- Date: Sat, 21 Oct 2006 22:39:36 -0500
I tried both of theses options and still get the same 'Bitmap Image isA dbImage will only display bitmap graphics
Invalid' Error message.
qryCompanyLOGO.LoadFromFile(SPicFileName);
(qryCompany.fieldbyName('LOGO') as TblobField).loadFromfile(SPicFileName);
The jpeg is valid because it will load into my DBImage with the following
code:
If you are trying to use a dbImage to directly display a jpeg that is your
problem.
You need to use a Timage to display a jpeg
here is some code you can use to load a jpeg to a timage
procedure TForm1.Table1AfterScroll(DataSet: TDataSet);
var
MS: TMemoryStream;
J1: TJPEGImage;
begin
J1 := TJPEGImage.Create;
MS := TMemoryStream.Create;
try
TBlobField(DataSet.Fieldbyname('myBlob')).SaveToStream(MS);
MS.Seek(0,soFromBeginning);
with J1 do begin
PixelFormat := jf24Bit;
Scale := jsFullSize;
Grayscale := False;
Performance := jpBestQuality;
ProgressiveDisplay := True;
ProgressiveEncoding := True;
LoadFromStream(MS);
end;
if MS.Size >0 then
Image1.Picture.Assign(J1)
else
Image1.Picture.Assign(nil);
finally
J1.Free;
MS.Free;
end;
end;
--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx
.
- References:
- Saving Image/Picture to Database using ADO
- From: Leonard Mann
- Re: Saving Image/Picture to Database using ADO
- From: Brian Bushay TeamB
- Re: Saving Image/Picture to Database using ADO
- From: Leonard Mann
- Saving Image/Picture to Database using ADO
- Prev by Date: Re: TADODataset.Filter?
- Next by Date: Re: ADO vs dbExpress
- Previous by thread: Re: Saving Image/Picture to Database using ADO
- Next by thread: Is this correct? (TADOConnection)
- Index(es):