Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Nov : FTP to Stream to Image
| Subject: | FTP to Stream to Image |
| Posted by: | "James Brown" (j..@seti.net) |
| Date: | Wed, 23 Nov 2005 22:55:30 |
I am attempting to download a JPG image, using FTP, and put it into a
TImage. This is the code:
------------------------------------------------------------
Procedure TForm1.btnGetOnceClick(Sender: TObject);
Var
TempStream: TMemoryStream;
JPG: TBitmap;
Begin
TempStream := TMemoryStream.Create;
JPG := TBitmap.Create;
Begin
FTP.Get('test.jpg', TempStream, True);
TempStream.Position := 0;
Image1.Picture.Bitmap.LoadFromStream(TempStream);
End;
TempStream.Free;
End;
-----------------------------------------------------------
It fails at the LoadFromStream instruction with the exception
EInvalidGraphic "Bitmap image is not valid"
Any help?
Thanks....... Jim