Skip to main content
Home Forums Silverlight Programming Programming with .NET - General The best way to retrieve images from the website containing the silverlight app
5 replies. Latest Post by dietmar1982 on December 2, 2008.
(0)
dietmar1982
Member
5 points
11 Posts
11-26-2008 10:36 AM |
Hey Guys!
If I where to build a sort of Image gallery in silverlight, but I don't want to include the pictures in the silverlight app itself .
How would I go about doing this. Should I just use a httphandler to retrieve them from the server, or is there another "smarter" way?
Thanks in advance
bryant
Star
9937 points
1,629 Posts
11-26-2008 11:24 AM |
Just put the full URL for the images as the ImageSource and they should load. http://yousite.com/images/imagex.jpg
You can use a downloader to get them asynchronously so that you don't cause the page to pause waiting for the image.
11-26-2008 12:08 PM |
Thanks for the reply.
Maybe I should have mentioned, that i was planning on only showing people on picture at the time, so perhaps i could use the downloader to download the next couple of picture while people are looking at the first one.
Jonathan...
All-Star
24939 points
2,425 Posts
12-01-2008 9:48 PM |
Hi Dietmar1982,
I would like to suggest you put these images under the ClientBin folder. We can create a folder with the name "images" under the ClientBin directory. ClientBin folder is shared by the Silverlight project and ASP.NET. Images are put inside ClientBin and its sub folders can be visited by using relative address. In other conditions, we need to use absolute address. For example, http://your website/images/imagename.extension.
dietmar1982:Maybe I should have mentioned, that i was planning on only showing people on picture at the time, so perhaps i could use the downloader to download the next couple of picture while people are looking at the first one.
In your condition, there is no need to use Downloader.
Best regards,
Jonathan
12-01-2008 11:19 PM |
Using the downloader would work just fine. Probably the best way to do this would be to create the list of URL images that you need to download and then start downloading them. Each time an image finishes downloading you could then go to the next image in the list. If you're not sure you will need them all every time then you could use some sort of current index to stay an image or two ahead of the user.
Do you need some sample code to get you started?
12-02-2008 2:54 AM |
Thanks for the reply guys, they are are very helpful.
And I don't think i'll need you to post some sample code Bryant, I'm sure i can find some somewhere on the net