This is a migrated thread and some comments may be shown as answers.

Best way to display an image from a URL

5 Answers 147 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 08 Oct 2010, 03:24 AM
What is the best control and code required to use to display an image when you know its absolute URL?

I have been trying to figure this one out, but a solution eludes me.

But I know it can be done because there are lots of potential solutions out there.

Since there are hundreds of thousands of images I reference, it seems best to use links rather than load them all in a database.

5 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 08 Oct 2010, 08:05 AM
Hi Andrew,

I'm not sure what you want to achieve. If you want to display images then the best control for this is Image control. Just set its Source property to the URL and it will do the rest.
There are some know limitations - only PNG and JPG formats are supported. In this link you can find more information about restrictions using URL:
http://msdn.microsoft.com/en-us/library/cc189008(v=VS.95).aspx

Let us know if you need more information.

Kind regards,
Hristo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Andrew
Top achievements
Rank 1
answered on 08 Oct 2010, 01:57 PM
I was hoping you would have an improved control.

For some reason if I hard code a URL into the XAML it works, but I can't seem to bind to a string holding a URL.
And when I search around the internet, i get conflicting, and complicated approaches.  Any chance you can show the way you would bind a simlle url to a jpg?  Sorry to bother you with this.
0
Hristo
Telerik team
answered on 08 Oct 2010, 10:12 PM
Hi Andrew,

I've attached simple project demonstrating that Binding to absolute URL is working as expected.
The problem may occur is your start-up project is not the Web project. Then different rule applies about URL access policy. You can read more in the link from my previous post.

I hope that this project will help you.

Best wishes,
Hristo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Andrew
Top achievements
Rank 1
answered on 09 Oct 2010, 02:47 AM
Thanks,
After hours of struggling, I found my problem was a change to IE setting that Live said I had to do to get live working for authentication.

So I managed to get it working, and it was of course simple.

In the code I set the DataContext and in xaml bound to the field name that holds the link (Link in my case).  Nothing to it.  Just tons of wasted time due to IE blocking the connection.

I appreciate your help given this was not anything to do with your products.
0
Hristo
Telerik team
answered on 10 Oct 2010, 08:32 PM
Hello Andrew,

I'm glad to hear that your issue is resolved.

Do not hesitate to write back if you have other questions.

All the best,
Hristo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Andrew
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Andrew
Top achievements
Rank 1
Share this question
or