Пример #1
0
        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);
        }