Esempio n. 1
0
        public static bool SaveImage2Server(string strPhysicalPath, string oldFileName, string newFileName, string newFileNameWatermark, string logo, int maxWidth, int maxHeight)
        {
            bool   bolResize = false;
            string strFullPath2Oldfilename = strPhysicalPath + @"\" + oldFileName;
            string strFullPath2Newfilename = strPhysicalPath + @"\" + newFileName;
            Bitmap bmpSource      = null;
            Bitmap bmpAfterResize = null;

            try
            {
                bmpSource      = getImageSource(strFullPath2Oldfilename, maxWidth, maxHeight);
                bmpAfterResize = GetScaledPicture(bmpSource, maxWidth, maxHeight);
                bmpAfterResize.Save(strFullPath2Newfilename);
                //
                HPCImageResize _until = new HPCImageResize();
                _until.WatermarkImages(strPhysicalPath, newFileNameWatermark, strFullPath2Newfilename, logo);
                _until = null;
                //
                bmpSource.Dispose();
                bolResize = DeleteImageSourceAfterResize(strFullPath2Oldfilename);
                //bmpAfterResize.Dispose();//BOCT EDIT
                //bmpAfterResize = null;//BOCT EDIT
                //bolResize = DeleteImageSourceAfterResize(strFullPath2Newfilename);// BOCT EDIT
                bolResize = true;
            }
            catch //(Exception ex)
            {
                bolResize = false;
            }
            return(bolResize);
        }
Esempio n. 2
0
        public static bool SaveImage2Server(string strPhysicalPath, string oldFileName, string newFileName, int maxWidth, int maxHeight)
        {
            bool   bolResize = false;
            string strFullPath2Oldfilename = strPhysicalPath + @"\" + oldFileName;
            string strFullPath2Newfilename = strPhysicalPath + @"\" + newFileName;
            Bitmap bmpSource      = null;
            Bitmap bmpAfterResize = null;

            try
            {
                bmpSource      = getImageSource(strFullPath2Oldfilename, maxWidth, maxHeight);
                bmpAfterResize = GetScaledPicture(bmpSource, maxWidth, maxHeight);
                //bmpAfterResize.Save(strFullPath2Newfilename);
                HPCImageResize _ul = new HPCImageResize();
                _ul.saveJpeg(strFullPath2Newfilename, bmpAfterResize, 100L);// HAM SUA
                bmpSource.Dispose();
                bolResize = DeleteImageSourceAfterResize(strFullPath2Oldfilename);
                bmpAfterResize.Dispose();
                bolResize = true;
            }
            catch //(Exception ex)
            {
                bolResize = false;
            }
            return(bolResize);
        }