title: Download an image from the web and store in media library (windows phone 8)
body: <p>i am trying to download an image from the web  save it in the media library , below is my code, am i missing something here, Thanks in advance</p>
  
  <pre><code>  public void storePicture()
      {
          try
          {
  
  
              using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
              {
  
                   string url = @"http://mynokiablog.com/wp-content/uploads/2012/11/wp8.jpeg";
  
                    BitmapImage storeimage = new BitmapImage(new Uri(url));
  
                    // height and width are 0 
                    int testheight = storeimage.PixelHeight;
                    int testwidth = storeimage.PixelWidth;
                  IsolatedStorageFileStream fileStream = myIsolatedStorage.CreateFile("testname");
                    // NullRefrenceException
                  WriteableBitmap wb = new WriteableBitmap(storeimage);
  
                  wb.SaveJpeg(fileStream, wb.PixelWidth, wb.PixelHeight, 0, 85);
                  fileStream.Close();
              }
  
          }
          catch (Exception ex)
          {
                 System.Diagnostics.Debug.WriteLine(ex.Message);
          }
  
      }
  </code></pre>