@+ Cirec
Function LoadImageFromUrl(Const aUrl: String; Const aImage: TImage): boolean;
Var
aStream : TMemoryStream;
Begin
Result := assigned(aImage);
If Result Then
Begin
aStream := TMemoryStream.Create;
With TIdHTTP.Create(nil) Do
Try
Try
Get(aUrl, aStream);
aStream.Seek(0, soFromBeginning);
aImage.Bitmap.LoadFromStream(aStream);
Except
Result := False;
End;
Finally
aStream.Free;
Free;
End;
End;
End;
procedure TForm3.Button2Click(Sender: TObject);
begin
if LoadImageFromUrl('http://images.playfrance.com/news/64941/zoom/0297.jpg',Image1) then
begin
showMessage('good uploaded');
end
else
begin
showMessage('failed uploaded');
end;
end;