Ver Mensaje Individual
  #7  
Antiguo 31-05-2008
Avatar de enecumene
[enecumene] enecumene is offline
Miembro de Oro
 
Registrado: may 2006
Ubicación: Santo Domingo, Rep. Dom.
Posts: 3.040
Reputación: 21
enecumene Va por buen camino
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; //if
           end; //while
          finally
        bS.Free
      end; //try
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.
__________________

Mi BLOG - ¡Joder, leanse la guia de estilo!
Las Palabras son enanas, los ejemplos gigantes.
Responder Con Cita