This shows you the differences between two versions of the page.
— |
public:howto:httpdownload [2007/11/30 14:30] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== How To Download And Display Image From WEB Server ====== | ||
+ | This is code sample for download JPEG image from WEB server and display it: | ||
+ | |||
+ | <code delphi> | ||
+ | uses | ||
+ | HTTPSend, Jpeg; | ||
+ | |||
+ | procedure TForm1.Button1Click(Sender: TObject); | ||
+ | var | ||
+ | jpg: TJPEGImage; | ||
+ | begin | ||
+ | with THTTPSend.Create do | ||
+ | begin | ||
+ | if HTTPMethod('GET','http://localhost/Iven.jpg') then | ||
+ | try | ||
+ | jpg:= TJPEGImage.Create; | ||
+ | jpg.LoadFromStream(Document); | ||
+ | Image1.Picture.Graphic:= jpg; | ||
+ | jpg.Free; | ||
+ | except | ||
+ | Application.MessageBox('Cannot display','Error', 0); | ||
+ | end; | ||
+ | Free; | ||
+ | end; | ||
+ | end; | ||
+ | </code> |