![]() |
Mostrar una imagen JPG
Hola a todos,... estuve buscando en el foro y encontre la manera de mostrar en un TImage una imagen almacenada en un campo de access tipo OLE... creo haber buscado lo suficiente como para pedir a alguien me pueda decir porque me sale el error "Invalid class typecast" en la linea donde hago el "SaveToStream"...¿¿???
Aqui esta el codigo:
Desde ya muchas gracias... espero haber dicho todo como para recibir alguna ayudita ;) |
Ya encontre la solucion...
Estuve buscando mas ejemplos y pude solucionar mi problema...
Acá pongo el codigo que quedo finalmente: Código Delphi [-]procedure TfraDefinicionNotificadores.MostrarFoto; var bS : TADOBlobStream; Pic : TJpegImage; begin bS := TADOBlobStream.Create(ADONotificadoresFoto, bmRead); try bS.Seek(JpegStartsInBlob(ADONotificadoresFoto), soFromBeginning); Pic:=TJpegImage.Create; try if Length(ADONotificadoresFoto.AsString)>0 then begin Pic.LoadFromStream(bS); imgFoto.Picture.Graphic:=Pic; end else imgFoto.Picture.Assign(nil); finally Pic.Free; end; finally bS.Free end; end; Código Delphi [-]function TfraDefinicionNotificadores.JpegStartsInBlob( PicField: TBlobField): integer; var bS : TADOBlobStream; buffer : Word; hx : string; begin Result := -1; bS := TADOBlobStream.Create(PicField, 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; |
La franja horaria es GMT +2. Ahora son las 10:07:03. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi