• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 359
  • Last Modified:

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
0
jamesr123456
Asked:
jamesr123456
  • 2
1 Solution
 
kretzschmarCommented:
i would guess like

ibdataset1.edit;  //or insert
TBlobField(ibdataset1.fieldByName('FieldNameHere')).LoadFromFile('FileNameHere'); //or loadfromstream
ibdataset.post;

meikl ;-)
0
 
jamesr123456Author Commented:
tblobfield!!!! im sure this isnt the first time ive forgotten it... thx :)
0
 
jamesr123456Author Commented:
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;
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now