Is it possible to place a TImage on an FMX form for iOS and load image (jpg) from an URL into this TImage to be displayed in the iOS app?
I have tried with no success. Any hints or point in the right direction is appreciated.
Drop a TButton, TImageControl and TIdHttp onto a Firemonkey form and this code will pull down an image from the web:
procedure TForm1.btnReadWebImgClick(Sender: TObject);
begin
ReadWebImage('http://www.gravatar.com/avatar/5af5f8c5f88c6c237745e9472a31410f?s=32&d=identicon&r=PG');
end;
procedure TForm1.ReadWebImage(imgAddress: string);
var
memStream: TMemoryStream;
begin
memStream := TMemoryStream.Create;
try
idhttp1.Get (imgAddress,memStream);
except
ShowMessage('Image not found at:'+imgAddress);
memStream.Free;
exit;
end;
try
memStream.Position := 0;
ImageControl1.Bitmap.LoadFromStream(memStream);
finally
memStream.Free;
end;
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With