Sigo con mi Odisea con este asunto lo que he hecho:
Función:
Código Delphi
[-]function CargarImagen(Campo:TBlobField): integer;
var
bS : TBlobStream;
buffer : Word;
hx : string;
begin
Result := -1;
bS := TBlobStream.Create(Campo, bmRead);
try
while (Result = -1) and
(bS.Position + 1 < bS.Size) do
begin
bS.ReadBuffer(buffer, 1);
hx := IntToHex(buffer, 2);
if hx = 'FF' then begin
bS.ReadBuffer(buffer, 1);
hx := IntToHex(buffer, 2);
if hx = 'D8' then Result := bS.Position - 2
else if hx = 'FF' then
bS.Position := bS.Position-1;
end; end; finally
bS.Free
end; end;
Aquí para cargar la imagen:
Código Delphi
[-]var
bs: TBlobStream;
Pic: TJPEGImage
begin
bS := TBlobStream.Create(ZTable1FOTO2, bmRead);
try
bS.Seek(CargarImagen(ZTable1FOTO2),soFromBeginning);
Pic:=TJpegImage.Create;
try
Pic.LoadFromStream(bS);
Foto.Picture.Graphic := Pic;
finally
Pic.Free;
end;
finally
bS.Free
end;
end;
Resultado:
Cita:
---------------------------
Debugger Exception Notification
---------------------------
Project TimerPunch.exe raised exception class EInvalidCast with message 'Invalid class typecast'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
|
Me voy a tirar de la ventana!!
.
Saludos.