How To Download And Display Image From WEB Server

This is code sample for download JPEG image from WEB server and display it:

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;
public/howto/httpdownload.txt · Last modified: 2007/11/30 14:30 (external edit)
Driven by DokuWiki Recent changes RSS feed