Load images from the web to a TImage component

206 views Asked by At

I have a TImage component in a XE7 FMX Android form. I would like to load images from the web onto it. I found this article, but unfortunately it seems to work only in Delphi XE5. I could use the Indy components to perform such task, but I would like to exhaust all possibilities before the inclusion of Indy in the project. Google isn't helping in this case, does anyone faced a similar situation? Is there a way to load images from a http site to a TImage component, without the use of Indy?

1

There are 1 answers

0
David Heffernan On

The code that you refer to in the question can readily be ported to XE7, if indeed it does not compile in XE7, a fact that I did not confirm.

However, that code uses Indy to perform the HTTP download. It does so in the AsyncTask.HTTP unit. So your analysis that this code is an Indy free, library free, way to download HTTP content is quite simply incorrect. The premise of your question is false.

Is there a way to load images from a http site to a TImage component, without the use of Indy?

Sure there is. You can:

  1. Find a different networking library that can perform HTTP downloads.
  2. Write your own code to perform HTTP downloads.

The latter option is certainly feasible. After all, that's all that Indy does. No doubt it wraps up the platform networking libraries. So you could write your own code that stands on top of the platform networking libraries, but I don't really see much point in doing that. Not least because it is a non-trivial task.