private String GenerateThumbnail(FormCollection form, String imageFileServerPath) { var thumbnailFileVirtualPath = String.Empty; if (form.BooleanValue(UploadHelper.GenerateThumbnailFlag)) { thumbnailFileVirtualPath = VirtualPathUtility.ToAbsolute(UploadHelper.GenerateThumbnailFileName(Path.GetExtension(imageFileServerPath))); var thumbnailFileServerPath = Server.MapPath(thumbnailFileVirtualPath); int resizeWidth = form.IntValue(UploadHelper.ThumbnailWidth); int resizeHeight = form.IntValue(UploadHelper.ThumbnailHeight); if (resizeWidth > 0 || resizeHeight > 0) { imageUtility.ResizeImage(imageFileServerPath, thumbnailFileServerPath, resizeWidth, resizeHeight); } } return(thumbnailFileVirtualPath); }
private void ResizeImage(FormCollection form, String targetFileServerPath) { if (form.BooleanValue(UploadHelper.ResizeImageFlag)) { int resizeWidth = form.IntValue(UploadHelper.ResizeImageWidth); int resizeHeight = form.IntValue(UploadHelper.ResizeImageHeight); if (resizeWidth > 0 || resizeHeight > 0) { try { imageUtility.ResizeImage(targetFileServerPath, targetFileServerPath, resizeWidth, resizeHeight); } catch (Exception ex) { Logger.Error("Some error was occured while ResizeImage file.", ex); } } } }