private string ProcessFile(ContentPropertyData editorValue, ContentItemFile file, string currentPath, Guid cuid, Guid puid)
        {
            // process the file
            // no file, invalid file, reject change
            if (UploadFileTypeValidator.ValidateFileExtension(file.FileName) == false)
            {
                return(null);
            }

            // get the filepath
            // in case we are using the old path scheme, try to re-use numbers (bah...)
            var filepath = _mediaFileSystem.GetMediaPath(file.FileName, currentPath, cuid, puid); // fs-relative path

            using (var filestream = File.OpenRead(file.TempFilePath))
            {
                _mediaFileSystem.AddFile(filepath, filestream, true); // must overwrite!

                var ext = _mediaFileSystem.GetExtension(filepath);
                if (_mediaFileSystem.IsImageFile(ext))
                {
                    var preValues = editorValue.PreValues.FormatAsDictionary();
                    var sizes     = preValues.Any() ? preValues.First().Value.Value : string.Empty;
                    using (var image = Image.FromStream(filestream))
                        _mediaFileSystem.GenerateThumbnails(image, filepath, sizes);
                }

                // all related properties (auto-fill) are managed by ImageCropperPropertyEditor
                // when the content is saved (through event handlers)
            }

            return(filepath);
        }
        private string ProcessFile(ContentPropertyData editorValue, ContentItemFile file, string currentPath, Guid cuid, Guid puid)
        {
            // process the file
            // no file, invalid file, reject change
            if (UploadFileTypeValidator.ValidateFileExtension(file.FileName) == false)
            {
                return(null);
            }

            // get the filepath
            // in case we are using the old path scheme, try to re-use numbers (bah...)
            var filepath = _mediaFileSystem.GetMediaPath(file.FileName, currentPath, cuid, puid); // fs-relative path

            using (var filestream = File.OpenRead(file.TempFilePath))
            {
                _mediaFileSystem.AddFile(filepath, filestream, true); // must overwrite!

                var ext = _mediaFileSystem.GetExtension(filepath);
                if (_mediaFileSystem.IsImageFile(ext) && ext != ".svg")
                {
                    var preValues = editorValue.PreValues.FormatAsDictionary();
                    var sizes     = preValues.Any() ? preValues.First().Value.Value : string.Empty;
                    try
                    {
                        using (var image = Image.FromStream(filestream))
                            _mediaFileSystem.GenerateThumbnails(image, filepath, sizes);
                    }
                    catch (ArgumentException ex)
                    {
                        // send any argument errors caused by the thumbnail generation to the log instead of failing miserably
                        LogHelper.WarnWithException <ImageCropperPropertyValueEditor>("Could not extract image thumbnails.", ex);
                    }
                }

                // all related properties (auto-fill) are managed by ImageCropperPropertyEditor
                // when the content is saved (through event handlers)
            }

            return(filepath);
        }