Esempio n. 1
0
        public static bool ChangeImage(string sourceFileFullName, long maxLength, string targetFileFullName)
        {
            Stream stream = null;
            bool   result = true;

            try
            {
                bool   flag  = false;
                byte[] array = ImageCompress.CompressImage(sourceFileFullName, maxLength, out flag);
                if (flag || !(sourceFileFullName == targetFileFullName))
                {
                    stream = File.Create(targetFileFullName);
                    stream.Write(array, 0, array.Length);
                }
            }
            catch (Exception ex)
            {
                Log.WriteLog(ex);
                result = false;
            }
            finally
            {
                if (stream != null)
                {
                    stream.Close();
                    stream.Dispose();
                }
            }
            return(result);
        }
Esempio n. 2
0
        public static byte[] CompressImage(string sourceFileFullName, long maxLength)
        {
            bool flag = false;

            return(ImageCompress.CompressImage(sourceFileFullName, maxLength, out flag));
        }