Hola koiji.
Cita:
Hola ecfisa estoy utilizando IBX ese codigo servira para poder insertar una imagen dentro de firebird las tablas que estoy utilzando seran las correctas
|
Entonces un ejemplo para almacenar imágenes de tipo
JPG con el componente
TIBQuery de
IBX:
Código Delphi
[-]
...
implementation
uses JPeg;
procedure TForm1.FormCreate(Sender: TObject);
begin
OpenDialog1.Filter:= 'Archivo de imágen | *.JPG;*.JPEG';
end;
procedure TForm1.Button1Click(Sender: TObject);
var
J: TJPEGImage;
MS: TMemoryStream;
begin
if OpenDialog1.Execute then
begin
J:= TJPEGImage.Create;
MS:= TMemoryStream.Create;
try
J.LoadFromFile(OpenDialog1.FileName);
J.SaveToStream(MS);
MS.Position:= 0;
IBQuery1.Close;
IBQuery1.SQL.Text:= 'INSERT INTO IMAGENES2(ID,IMAGE) VALUES(:ID,:IMG)';
IBQuery1.ParamByName('ID').AsInteger:= 13;
IBQuery1.ParamByName('IMG').LoadFromStream(MS, ftBlob);
IBQuery1.ExecSQL;
finally
J.Free;
MS.Free;
end;
end;
end;
Saludos