Link to home
Start Free TrialLog in
Avatar of jamesr123456
jamesr123456

asked on

INTERBASE IBDATASET IMAGE BLOB

Hi,

I'd like to know how to store a jpg/bmp as a blob in interbase using the ibdataset component.

thx
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jamesr123456
jamesr123456

ASKER

tblobfield!!!! im sure this isnt the first time ive forgotten it... thx :)
dbImage dosnt support jpg from what I can see... a further example for any1 looking:

var
S: TStream;
I: TJpegImage;

// to write image

begin
image1.Picture.LoadFromFile(fileimage.FileName);
I := TJpegImage.Create;
I.Assign(Image1.Picture.Graphic);
S := ibDataSet1.CreateBlobStream(ibDataSet1.FieldByName('product_picture'), bmWrite);
I.SaveToStream(S);
S.Free;
I.Free;
end;

// to read image

begin
I := TJpegImage.Create;
S := ibDataSet1.CreateBlobStream(ibDataSet1.FieldByName('product_picture'), bmRead);
I.LoadFromStream(S);
Image1.Picture.Assign(I);
I.Free;
S.Free;
end;