Example #1
0
        public static string MakeThumbnail(string filesource, string path, string fileName)
        {
            string temp = "";

            fileName = fileName + ".jpg";
            try
            {
                Image img = Image.FromFile(filesource);
                if (img.Width > img.Height)
                {
                    if (img.Height > size)
                    {
                        ImageTool.MakeThumbnail(filesource, path + fileName, size, size, "H");
                    }
                    else
                    {
                        SysIOHelper.CopyFile(filesource, path, fileName);
                    }
                }
                else
                {
                    if (img.Width > size)
                    {
                        ImageTool.MakeThumbnail(filesource, path + fileName, size, size, "W");
                    }
                    else
                    {
                        SysIOHelper.CopyFile(filesource, path, fileName);
                    }
                }
                img.Dispose();
                temp = fileName;
            }
            catch (System.Exception ex)
            {
                temp = String.Empty;
                throw ex;
            }
            return(temp);
        }
Example #2
0
        public static string MakeThumbnail(string filesource, string path)
        {
            string temp = "";

            try
            {
                Image  img = Image.FromFile(filesource);
                String PictureFileName_ALL = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss_fff") + ".jpg";
                if (img.Width > img.Height)
                {
                    if (img.Height > size)
                    {
                        ImageTool.MakeThumbnail(filesource, path + PictureFileName_ALL, size, size, "H");
                    }
                    else
                    {
                        SysIOHelper.CopyFile(filesource, path, PictureFileName_ALL);
                    }
                }
                else
                {
                    if (img.Width > size)
                    {
                        ImageTool.MakeThumbnail(filesource, path + PictureFileName_ALL, size, size, "W");
                    }
                    else
                    {
                        SysIOHelper.CopyFile(filesource, path, PictureFileName_ALL);
                    }
                }
                img.Dispose();
                temp = PictureFileName_ALL;
            }
            catch (System.Exception ex)
            {
                temp = String.Empty;
                throw ex;
            }
            return(temp);
        }