title: download all Images of a Website
body: <p>So I just started learning C# last night. The first project I started was a simple Image-Downloader, which downloads all images of a website using HtmlElementCollection.</p>
  
  <p>Here's what I got so far: </p>
  
  <pre><code>    private void dl_Click(object sender, EventArgs e)
      {
          System.Net.WebClient wClient = new System.Net.WebClient();
  
          HtmlElementCollection hecImages = Browser.Document.GetElementsByTagName("img");
  
          for (int i = 0; i &lt; hecImages.Count - 1; i++)
          {
  
              char[] ftype = new char[4];
              string gtype;
  
              try
              {
                  //filetype
                  hecImages[i].GetAttribute("src").CopyTo(hecImages[i].GetAttribute("src").Length -4,ftype,0,4) ;
                  gtype = new string(ftype);
  
                  //copy image to local path
                  wClient.DownloadFile(hecImages[i].GetAttribute("src"), absPath + i.ToString() + gtype);                                                                               
              }
              catch (System.Net.WebException) 
              {
                  expand_Exception_Log();
                  System.Threading.Thread.Sleep(50);
              }
  </code></pre>
  
  <p>Basically it's rendering the page in advance and looking for the images. This works pretty well, but for some reason it only downloads the Thumbnails, but not the full (high-res) image. </p>
  
  <p>Additional Sources:</p>
  
  <p>Documentation on WebClient.DownloadFile: <a href="http://msdn.microsoft.com/en-us/library/ez801hhe(v=vs.110).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ez801hhe(v=vs.110).aspx</a></p>
  
  <blockquote>
    <p>The DownloadFile method downloads to a local file data from the URI specified by in the address parameter.</p>
  </blockquote>