Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Firebird e Interbase (https://www.clubdelphi.com/foros/forumdisplay.php?f=19)
-   -   Visualizar BLOB (https://www.clubdelphi.com/foros/showthread.php?t=17999)

Loviedo 28-01-2005 14:14:48

Visualizar BLOB
 
Este procedimiento funciona bien con tablas Paradox para visualizar Jpg con un Timage, pero con Firebird me sale el siguiente error:
'Invalid class Typecast'.
Tengo creado el Campo Blob de Firebird como
'BLOB SUB_TYPE 0 SEGMENT SIZE 2048'
tambien he probado con
'BLOB SUB_TYPE 0 SEGMENT SIZE 4096'
el tamaño del Jpg es de 38KB
Gracias anticipadas.

procedure TForm1.Button3Click(Sender: TObject);
var
BS: TBlobStream;
Graphic: TGraphic;
begin
if FDM.IBtable2foto.isnull then
Image1.picture.graphic:=nil
else
begin
BS:=TBlobStream.Create(FDM.IBtable2foto,bmread);
try
Graphic:= TJPEGImage.Create;
try
Graphic.LoadFromStream(BS);
Image1.picture.graphic:=Graphic;
Finally
Graphic.Free;
end;
Finally
BS.free;
end;
end;
end;

Loviedo 28-01-2005 18:53:21

Ya me funciona.

procedure TForm1.Button3Click(Sender: TObject);
var
BS: TStream;
Graphic: TGraphic;
begin
if FDM.IBtable2FOTO.isnull then
Image1.picture.graphic:=nil
else
begin
BS := FDM.IBtable2.CreateBlobStream(FDM.IBTable2.FieldByName('FOTO'), bmRead);
try
Graphic := TJPEGImage.Create;
try
Graphic.LoadFromStream(BS);
Image1.Picture := nil;
Image1.picture.graphic := Graphic;
Finally
Graphic.Free;
end;
Finally
BS.free;
end;
end;
end;


La franja horaria es GMT +2. Ahora son las 17:29:11.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi