1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
//Ecreture
var
S:string;
img:TImage;
begin
if PromptForfilename(S,GraphicFilter(TGraphic)) then
begin
img := TImage.Create(nil);
with Table1.CreateBlobStream(Table1.FieldByName('Picture'), bmWrite) do
try
img.Picture.LoadFromFile(S);
Position:=0;
WriteComponent(img);
img.Picture.Graphic := nil;
finally
img.Free;
Free;
end;
end;
end;
//Lecture
var
Stream : TStream;
img:TImage;
begin
Image1.Picture.Graphic := nil;
img := TImage.Create(nil);
with Table1.CreateBlobStream(Table1.FieldByName('Picture'), bmRead) do
try
Position:=0;
try
ReadComponent(img);
Image1.Picture.Assign(img.Picture);
img.Picture.Graphic := nil;
except
end;
finally
img.Free;
Free;
end;
end; |