Hello, I am looking for any code samples that show how to pull images from URL into Delphi TImage component.
Thanks,
Hello, I am looking for any code samples that show how to pull images from URL into Delphi TImage component.
Thanks,
With help of TMemoryStream and Indy component.
uses
GIFImg;
procedure TForm1.btn1Click(Sender: TObject);
var
MS : TMemoryStream;
GIf: TGIFImage;
begin
MS := TMemoryStream.Create;
GIf := TGIFImage.Create;
try
IdHTTP1.get('http://www.google.com/intl/en_ALL/images/logo.gif',MS);
Ms.Seek(0,soFromBeginning);
Gif.LoadFromStream(MS);
img1.Picture.Assign(GIF);
finally
FreeAndNil(GIF);
FreeAndNil(MS);
end;
end;
Tank you a lot, very usefull code, i was getting crazy assigning directly the "Stream" to "image1.picture"
but i have to use the code to retrive this file: http://www.clickufficio.it/5308.image?Catalog=HOPE%5FClick&ID=10613&Type=Normal&Name=1
it is not a proper file, but if you past it in the browser you get a picture (it has no html code)
but in Delphi it raises an exception. It seems there is no redirect ether.
ty you in advance Antonio