[FONT=monospace]
Bonjour,

J'ai un champ blob dans une table dans une bd Firebird contenant une image au format JEPG.
Je souhaiterais afficher cette image sur une Form.

Voici le code que j'utilise :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
 
procedure TForm1.Button4Click(Sender: TObject);
var
  PhotoJPEG: TJPEGImage;
  PhotoStream: TMemoryStream;
begin
 
  IBOPhoto.Open;
  IBOPhoto.First;
 
  PhotoStream := TMemoryStream.Create;
  IBOPhotoPHOTO.SaveToStream(PhotoStream);
 
 
  try
    PhotoJPEG := TJPEGImage.Create;
    try
      PhotoJPEG.LoadFromStream(PhotoStream);
      Image2.Picture.Assign(PhotoJPEG);
    finally
      FreeAndNil(PhotoJPEG);
    end;
  finally
    FreeANdNil(PhotoStream);
  end;
  IBOPhoto.Close;
 
end;
Apres l exécution du code une exception de type EJPEG se produit avec le message d'erreur "Erreur JPEG #42" . De quoi cela viens t il selon vous?

Merci d avance.[/Font]