/// <summary>
 /// Loads the image from the given path
 /// </summary>
 /// <param name="path">Path of image that should be used for this banner</param>
 /// <returns>True if successful, false otherwise</returns>
 protected Image LoadImage(String path)
 {
     try
     {
         WebClient    client  = new CompressionWebClient();
         byte[]       imgData = client.DownloadData(path);
         MemoryStream ms      = new MemoryStream(imgData);
         Image        img     = Image.FromStream(ms, true, true);
         return(img);
     }
     catch (Exception ex)
     {
         Log.Error("Error while loading image ", ex);
         return(null);
     }
 }
        private void DownloadThumbnail()
        {
            try
            {
                if (!Directory.Exists(Package.LocationFolder))
                {
                    Directory.CreateDirectory(Package.LocationFolder);
                }

                string url = Package.GeneralInfo.Params[ParamNamesConst.ONLINE_ICON].Value;
                if (url.IndexOf("://") < 0)
                {
                    url = "http://" + url;
                }
                var    client  = new CompressionWebClient();
                byte[] imgData = client.DownloadData(url);
                var    ms      = new MemoryStream(imgData);
                var    image   = Image.FromStream(ms);
                img_logo.Image = image;
                string fileName = "";
                if (ImageFormat.Jpeg.Equals(image.RawFormat))
                {
                    fileName = "icon.jpg";
                }
                else if (ImageFormat.Png.Equals(image.RawFormat))
                {
                    fileName = "icon.png";
                }
                else if (ImageFormat.Gif.Equals(image.RawFormat))
                {
                    fileName = "icon.gif";
                }
                else if (ImageFormat.Icon.Equals(image.RawFormat))
                {
                    fileName = "icon.ico";
                }
                else if (ImageFormat.Bmp.Equals(image.RawFormat))
                {
                    fileName = "icon.bmp";
                }
                if (!string.IsNullOrEmpty(fileName))
                {
                    File.WriteAllBytes(Path.Combine(Package.LocationFolder, fileName), imgData);
                }
            }
            catch (Exception) { } // invalid url or image file or no internet connection
        }