locked
best practice for image loading RRS feed

  • Question

  • Hi,

    I'm trying to build a dynamic image gallery where I can load images from a webserver. I know we can load images asynchronously by setting the Source property on the image. However, I'm not sure if that is the best way to load images if there are tons of them. What is the general best practice for image loading?

    Thanks in advance!

    Wednesday, December 30, 2009 2:58 PM

Answers

All replies

  • pagination logic where you preload the images surrounding the current image each time the next image is displayed.  if you want to get fancy you can tweak the number of images you preload based on how quickly the user is flipping through.

    Wednesday, December 30, 2009 3:04 PM
  • what control can I use to enforce pagination logic? Do you mean I should only set the source on the image control when I want it to start fetching the image?

    Wednesday, December 30, 2009 3:19 PM
  • On this site: http://www.johannormen.com I zip packed the images, and load them with the WebClient class.. Some categories uses a lot of images and because the site shows photos, the resolution of the images must be high..

    One way to make the images appears much faster is by loading one at a time, for example when a user take a look at the image, or you could also load them async. one by one in the background to prepare the site to show them much faster.. everything depends on how many imanges you have, how you want to show them.. how big they are etc.

    Wednesday, December 30, 2009 4:10 PM
  • Thanks Fredrik! You mentioned I can load images one by one in the background. How can I achieve that?

    Wednesday, December 30, 2009 7:38 PM
  • There are different ways, but if you take a look at the following blog post you can see examples of loading images:

    http://blogs.msdn.com/katriend/archive/2008/04/27/different-ways-for-loading-images-and-files-in-silverlight-2-applications.aspx

     

    Thursday, December 31, 2009 3:25 AM