Re:Printing jpg pictures URGENT
You must use blob or graphics field for storing jpeg pictures.
Also u can't display them directly in DBImage, but u can read and show them
them on Image.
Here's how you read them :
procedure TForm1.Query1AfterScroll(DataSet: TDataSet);
var
MS: TMemoryStream;
J1: TJPEGImage;
begin
// copy JPEG from Table to Image1
J1 := TJPEGImage.Create;
MS := TMemoryStream.Create;
if Dataset.Fieldbyname('JpgPicture').isnull then // no data available
Image1.Picture := nil // <<=== then clear pointer to previous picture!
else begin
try
TBlobField(Dataset.Fieldbyname('JpgPicture')).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.Assign(J1);
finally
J1.Free;
MS.Free;
end;
end;
end;
This is AfterScroll event for TQuery (TTable).
You can put images in DB, using TQuery and something like:
Query1.Params[0].LoadFromFile('pic.jpg');
Hope that helps !!!