public FileUploadPropertyEditor(ILogger logger, IMediaFileSystem mediaFileSystem, IContentSection contentSection)
     : base(logger)
 {
     _mediaFileSystem          = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
     _contentSection           = contentSection;
     _uploadAutoFillProperties = new UploadAutoFillProperties(_mediaFileSystem, logger, contentSection);
 }
Exemplo n.º 2
0
        /// <inheritdoc />
        public string GetFilePath(IMediaFileSystem fileSystem, Guid itemGuid, Guid propertyGuid, string filename, string previous = null)
        {
            string directory;

            if (previous != null)
            {
                // old scheme, with a previous path
                // prevpath should be "<int>/<filename>" OR "<int>-<filename>"
                // and we want to reuse the "<int>" part, so try to find it

                var sep = Current.Configs.Settings().Content.UploadAllowDirectories ? "/" : "-";
                var pos = previous.IndexOf(sep, StringComparison.Ordinal);
                var s   = pos > 0 ? previous.Substring(0, pos) : null;

                directory = pos > 0 && int.TryParse(s, out _) ? s : GetNextDirectory(fileSystem);
            }
            else
            {
                directory = GetNextDirectory(fileSystem);
            }

            if (directory == null)
            {
                throw new InvalidOperationException("Cannot use a null directory.");
            }

            return(Current.Configs.Settings().Content.UploadAllowDirectories
                ? Path.Combine(directory, filename).Replace('\\', '/')
                : directory + "-" + filename);
        }
Exemplo n.º 3
0
 public ArticulateDataInstaller(IContentTypeService contentTypeService, IContentService contentService,
                                IPackageInstallation packageInstallation,
                                IPackagingService packagingService, IDataTypeService dataTypeService, ILogger logger,
                                IMediaFileSystem mediaFileSystem)
     : this(contentTypeService, contentService, packageInstallation, packagingService, dataTypeService, logger, mediaFileSystem, Current.Services.LocalizationService)
 {
 }
Exemplo n.º 4
0
 protected GeneratorBase(IUmbracoContextFactory umbracoContextFactory, IStaticSiteStorer storer, IImageCropNameGenerator imageCropNameGenerator, IMediaFileSystem mediaFileSystem)
 {
     _umbracoContextFactory = umbracoContextFactory;
     _storer = storer;
     _imageCropNameGenerator = imageCropNameGenerator;
     _mediaFileSystem        = mediaFileSystem;
 }
Exemplo n.º 5
0
 public DiagnosticService(IUmbracoDatabaseService databaseService, IMediaFileSystem mediaFileSystem, IRuntimeState runtimeState, HttpContextBase httpContext = null)
 {
     this.databaseService = databaseService ?? throw new ArgumentNullException("The database service that was passed to the Diagnostic Service was null");
     this.httpContext     = httpContext;
     this.mediaFileSystem = mediaFileSystem;
     this.runtimeState    = runtimeState;
 }
Exemplo n.º 6
0
        /// <inheritdoc />
        public string GetFilePath(IMediaFileSystem fileSystem, Guid itemGuid, Guid propertyGuid, string filename, string previous = null)
        {
            var combinedGuid = GuidUtils.Combine(itemGuid, propertyGuid);
            var directory    = GuidUtils.ToBase32String(combinedGuid, DirectoryLength);

            return(Path.Combine(directory, filename).Replace('\\', '/'));
        }
Exemplo n.º 7
0
        /// <inheritdoc />
        public string GetFilePath(IMediaFileSystem fileSystem, Guid itemGuid, Guid propertyGuid, string filename, string previous = null)
        {
            // assumes that cuid and puid keys can be trusted - and that a single property type
            // for a single content cannot store two different files with the same name
            var directory = HexEncoder.Encode(GuidUtils.Combine(itemGuid, propertyGuid).ToByteArray() /*'/', 2, 4*/); // could use ext to fragment path eg 12/e4/f2/...

            return(Path.Combine(directory, filename).Replace('\\', '/'));
        }
 public MetaWeblogHandler(IUmbracoContextAccessor umbracoContextAccessor, IContentService contentService, ITagService tagService, IUserService userService, IMediaFileSystem mediaFileSystem)
 {
     _umbracoContextAccessor = umbracoContextAccessor;
     _contentService         = contentService;
     _tagService             = tagService;
     _userService            = userService;
     _mediaFileSystem        = mediaFileSystem;
 }
Exemplo n.º 9
0
 public PdfTextService(
     IPdfTextExtractor pdfTextExtractor,
     IMediaFileSystem mediaFileSystem)
 {
     _pdfTextExtractor = pdfTextExtractor;
     _mediaFileSystem  = mediaFileSystem;
     _logger           = Current.Logger;
 }
Exemplo n.º 10
0
 public ImagePreprocessingComponent(IMediaFileSystem mediaFileSystem, IContentSection contentSection,
                                    IMediaService mediaService, IMediaTypeService mediaTypeService, IContentTypeBaseServiceProvider contentTypeBaseService)
 {
     _mediaFileSystem        = mediaFileSystem;
     _contentSection         = contentSection;
     _mediaService           = mediaService;
     _mediaTypeService       = mediaTypeService;
     _contentTypeBaseService = contentTypeBaseService;
 }
Exemplo n.º 11
0
 public PdfTextService(
     IPdfTextExtractor pdfTextExtractor,
     IMediaFileSystem mediaFileSystem,
     ILogger logger)
 {
     _pdfTextExtractor = pdfTextExtractor;
     _mediaFileSystem  = mediaFileSystem;
     _logger           = logger;
 }
 public RoxyFileManagerController(
     Lazy <IImageResizerService> imageResizer,
     Lazy <IPictureService> pictureService,
     IMediaFileSystem fileSystem)
 {
     _imageResizer   = imageResizer;
     _pictureService = pictureService;
     _fileSystem     = fileSystem;
 }
Exemplo n.º 13
0
        public ImageCache(MediaSettings mediaSettings, IMediaFileSystem fileSystem, IImageProcessor imageProcessor)
        {
            _mediaSettings  = mediaSettings;
            _fileSystem     = fileSystem;
            _imageProcessor = imageProcessor;

            _thumbsRootDir = "Thumbs/";

            Logger = NullLogger.Instance;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ImageCropperPropertyEditor"/> class.
        /// </summary>
        public ImageCropperPropertyEditor(ILogger logger, IMediaFileSystem mediaFileSystem, IContentSection contentSettings, IDataTypeService dataTypeService)
            : base(logger)
        {
            _mediaFileSystem = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
            _contentSettings = contentSettings ?? throw new ArgumentNullException(nameof(contentSettings));
            _dataTypeService = dataTypeService;

            // TODO: inject?
            _autoFillProperties = new UploadAutoFillProperties(_mediaFileSystem, logger, _contentSettings);
        }
Exemplo n.º 15
0
 public ForumsApiController(IContentService contentservice, IContentTypeService contenttypeservice, IMemberTypeService memberservice, IMemberGroupService memberGroupService, IDataTypeService dataTypeService, ILocalizationService localizationService, IMediaFileSystem mediaFileSystem)
 {
     _contentService      = contentservice;
     _memberTypeService   = memberservice;
     _memberGroupService  = memberGroupService;
     _dataTypeService     = dataTypeService;
     _localizationService = localizationService;
     _contenttypeservice  = contenttypeservice;
     _mediaFileSystem     = mediaFileSystem;
 }
Exemplo n.º 16
0
        public ImageCache(
            MediaSettings mediaSettings,
            IMediaFileSystem fileSystem,
            MediaHelper mediaHelper)
        {
            _mediaSettings = mediaSettings;
            _fileSystem    = fileSystem;

            _thumbsRootDir = "Thumbs/";
        }
Exemplo n.º 17
0
 public MetaWeblogHandler(IUmbracoContextAccessor umbracoContextAccessor, IContentService contentService, ITagService tagService, IUserService userService, IMediaFileSystem mediaFileSystem, ILocalizationService localizationService, IContentTypeService contentTypeService, IDataTypeService dataTypeService)
 {
     _umbracoContextAccessor = umbracoContextAccessor;
     _contentService         = contentService;
     _tagService             = tagService;
     _userService            = userService;
     _mediaFileSystem        = mediaFileSystem;
     _localizationService    = localizationService;
     _contentTypeService     = contentTypeService;
     _dataTypeService        = dataTypeService;
 }
Exemplo n.º 18
0
        public ImageCache(
            MediaSettings mediaSettings,
            IMediaFileSystem fileSystem,
            IImageProcessor imageProcessor,
            IFolderService folderService,
            MediaHelper mediaHelper)
        {
            _mediaSettings = mediaSettings;
            _fileSystem    = fileSystem;

            _thumbsRootDir = "Thumbs/";
        }
 public ArticulateDataInstaller(IContentTypeService contentTypeService, IContentService contentService,
                                IPackageInstallation packageInstallation,
                                IPackagingService packagingService, IDataTypeService dataTypeService, ILogger logger,
                                IMediaFileSystem mediaFileSystem)
 {
     _contentTypeService  = contentTypeService;
     _contentService      = contentService;
     _packageInstallation = packageInstallation;
     _packagingService    = packagingService;
     _dataTypeService     = dataTypeService;
     _logger          = logger;
     _mediaFileSystem = mediaFileSystem;
 }
        public MemberExtendedService(IScopeProvider provider, ILogger logger, IEventMessagesFactory eventMessagesFactory,
                                     IMemberGroupService memberGroupService, IMediaFileSystem mediaFileSystem,
                                     IMemberRepository memberRepository, IMemberTypeRepository memberTypeRepository,
                                     IMemberGroupRepository memberGroupRepository, IAuditRepository auditRepository,
                                     IExamineManager examineManager)
            : base(provider, logger, eventMessagesFactory, memberGroupService, mediaFileSystem,
                   memberRepository, memberTypeRepository, memberGroupRepository, auditRepository)
        {
            this.logger = new Logging <MemberExtendedService>(logger);
#endif
            this.memberGroupService = memberGroupService;
            this.memberRepository   = memberRepository;
            this.examineManager     = examineManager;
        }
 public RoxyFileManagerController(
     Lazy <IImageProcessor> imageProcessor,
     Lazy <IImageCache> imageCache,
     IMediaFileSystem fileSystem,
     IEventPublisher eventPublisher,
     ILocalizationFileResolver locFileResolver,
     Lazy <MediaSettings> mediaSettings)
 {
     _imageProcessor  = imageProcessor;
     _imageCache      = imageCache;
     _fileSystem      = fileSystem;
     _eventPublisher  = eventPublisher;
     _locFileResolver = locFileResolver;
     _mediaSettings   = mediaSettings;
 }
Exemplo n.º 22
0
        public ImageCache(
            MediaSettings mediaSettings,
            IStoreContext storeContext,
            HttpContextBase httpContext,
            IMediaFileSystem fileSystem,
            IImageResizerService imageResizerService)
        {
            _mediaSettings       = mediaSettings;
            _storeContext        = storeContext;
            _httpContext         = httpContext;
            _fileSystem          = fileSystem;
            _imageResizerService = imageResizerService;

            _thumbsRootDir = "Thumbs/";

            Logger = NullLogger.Instance;
        }
Exemplo n.º 23
0
        public MediaController(
            IPictureService pictureService,
            IImageProcessor imageProcessor,
            IImageCache imageCache,
            IUserAgent userAgent,
            IEventPublisher eventPublisher,
            IMediaFileSystem mediaFileSystem,
            MediaSettings mediaSettings)
        {
            _pictureService  = pictureService;
            _imageProcessor  = imageProcessor;
            _imageCache      = imageCache;
            _userAgent       = userAgent;
            _eventPublisher  = eventPublisher;
            _mediaFileSystem = mediaFileSystem;
            _mediaSettings   = mediaSettings;

            Logger = NullLogger.Instance;
        }
Exemplo n.º 24
0
        public RoxyFileManagerController(
            IMediaService mediaService,
            IFolderService folderService,
            IAlbumRegistry albumRegistry,
            IMediaTypeResolver mediaTypeResolver,
            MediaHelper mediaHelper,
            MediaExceptionFactory exceptionFactory,
            //IMediaFileSystem fileSystem,
            ILocalizationFileResolver locFileResolver)
        {
            _mediaTypeResolver = mediaTypeResolver;
            _mediaHelper       = mediaHelper;
            _locFileResolver   = locFileResolver;

            _album      = albumRegistry.GetAlbumByName(SystemAlbumProvider.Files);
            _fileSystem = new MediaServiceFileSystemAdapter(mediaService, folderService, _mediaHelper, exceptionFactory);
            _fileRoot   = _album.Name;

            //_fileSystem = fileSystem;
            //_fileRoot = "Uploaded";
        }
Exemplo n.º 25
0
        public MediaMigrator(
            ICommonServices services,
            IProviderManager providerManager,
            IMediaTypeResolver mediaTypeResolver,
            IAlbumRegistry albumRegistry,
            IFolderService folderService,
            IMediaTracker mediaTracker,
            IMediaFileSystem mediaFileSystem)
        {
            _services          = services;
            _providerManager   = providerManager;
            _mediaTypeResolver = mediaTypeResolver;
            _albumRegistry     = albumRegistry;
            _folderService     = folderService;
            _mediaTracker      = mediaTracker;
            _mediaFileSystem   = mediaFileSystem;

            var storageProviderSystemName = _services.Settings.GetSettingByKey("Media.Storage.Provider", DatabaseMediaStorageProvider.SystemName);

            _mediaStorageProvider = _providerManager.GetProvider <IMediaStorageProvider>(storageProviderSystemName).Value;
            _isFsProvider         = _mediaStorageProvider is FileSystemMediaStorageProvider;
        }
Exemplo n.º 26
0
 public MediaMigrator(
     ICommonServices services,
     IProviderManager providerManager,
     Func <IMediaStorageProvider> mediaStorageProvider,
     IMediaTypeResolver mediaTypeResolver,
     IAlbumRegistry albumRegistry,
     IFolderService folderService,
     IMediaTracker mediaTracker,
     IImageCache imageCache,
     IMediaFileSystem mediaFileSystem)
 {
     _services             = services;
     _providerManager      = providerManager;
     _mediaTypeResolver    = mediaTypeResolver;
     _albumRegistry        = albumRegistry;
     _folderService        = folderService;
     _mediaTracker         = mediaTracker;
     _mediaFileSystem      = mediaFileSystem;
     _imageCache           = imageCache;
     _mediaStorageProvider = mediaStorageProvider();
     _isFsProvider         = _mediaStorageProvider is FileSystemMediaStorageProvider;
 }
Exemplo n.º 27
0
        public MediaController(
            IPictureService pictureService,
            IImageProcessor imageProcessor,
            IImageCache imageCache,
            IUserAgent userAgent,
            IEventPublisher eventPublisher,
            IMediaFileSystem mediaFileSystem,
            MediaSettings mediaSettings,
            Lazy <SeoSettings> seoSettings,
            Lazy <IXmlSitemapGenerator> sitemapGenerator)
        {
            _pictureService   = pictureService;
            _imageProcessor   = imageProcessor;
            _imageCache       = imageCache;
            _userAgent        = userAgent;
            _eventPublisher   = eventPublisher;
            _mediaFileSystem  = mediaFileSystem;
            _mediaSettings    = mediaSettings;
            _seoSettings      = seoSettings;
            _sitemapGenerator = sitemapGenerator;

            Logger = NullLogger.Instance;
        }
Exemplo n.º 28
0
        /*
         *     <add key="punkOptimise:ReduceFileExtensions" value="jpg,jpeg" />
         *     <add key="punkOptimise:ShrinkfileExtensions" value="png" />
         *     <add key="punkOptimise:DefaultQuality" value="70" />
         *     <add key="punkOptimise:TinyPng:ApiUrl" value="https://api.tinify.com/shrink" />
         *     <add key="punkOptimise:TinyPng:ApiKey" value="" />
         */

        public OptimiseController(
            IMediaService mediaService,
            IImageShrinkService shrinkService,
            IImageReductionService imageService,
            IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
            IMediaFileSystem mediaFileSystem)
        {
            _mediaService    = mediaService;
            _mediaFileSystem = mediaFileSystem;
            _contentTypeBaseServiceProvider = contentTypeBaseServiceProvider;
            _shrinkService = shrinkService;
            _imageService  = imageService;

            _reduceFileExtensions = ConfigurationManager.AppSettings["punkOptimise:ReduceFileExtensions"]?.ToString();
            _shrinkfileExtensions = ConfigurationManager.AppSettings["punkOptimise:ShrinkfileExtensions"]?.ToString();

            _validFileExtensions = new List <string>();
            _validFileExtensions.AddRange(_reduceFileExtensions?.SplitToList());

            if (_shrinkService.IsEnabled())
            {
                _validFileExtensions.AddRange(_shrinkfileExtensions?.SplitToList());
            }
        }
Exemplo n.º 29
0
 public FileSystemMediaStorageProvider(IMediaFileSystem fileSystem)
 {
     _fileSystem = fileSystem;
 }
Exemplo n.º 30
0
 public ImageCropperPropertyValueEditor(DataEditorAttribute attribute, ILogger logger, IMediaFileSystem mediaFileSystem)
     : base(attribute)
 {
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
     _mediaFileSystem = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
 }