Exemple #1
0
        public static bool LocalImage2Thumbs(string originalImagePath, string thumbnailPath, int width, int height, string mode)
        {
            Image image = Image.FromFile(originalImagePath);

            ImageHelp.Image2Thumbs(image, thumbnailPath, width, height, mode);
            image.Dispose();
            return(true);
        }
 public static bool RemoteImage2Thumbs(string remoteImageUrl, string thumbnailPath, int width, int height, string mode)
 {
     try
     {
         WebRequest webRequest = WebRequest.Create(remoteImageUrl);
         webRequest.Timeout = 20000;
         Image originalImage = Image.FromStream(webRequest.GetResponse().GetResponseStream());
         ImageHelp.Image2Thumbs(originalImage, thumbnailPath, width, height, mode);
         originalImage.Dispose();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemple #3
0
        public static bool RemoteImage2Thumbs(string remoteImageUrl, string thumbnailPath, int width, int height, string mode)
        {
            bool result;

            try
            {
                WebRequest webRequest = WebRequest.Create(remoteImageUrl);
                webRequest.Timeout = 20000;
                Stream responseStream = webRequest.GetResponse().GetResponseStream();
                Image  image          = Image.FromStream(responseStream);
                ImageHelp.Image2Thumbs(image, thumbnailPath, width, height, mode);
                image.Dispose();
                result = true;
            }
            catch
            {
                result = false;
            }
            return(result);
        }