Пример #1
0
 public ImageTagRenderingService(ISession session, IImageProcessor imageProcessor, IFileService fileService, MediaSettings mediaSettings)
 {
     _session = session;
     _imageProcessor = imageProcessor;
     _fileService = fileService;
     _mediaSettings = mediaSettings;
 }
Пример #2
0
 public FileService(ISession session, IFileSystem fileSystem, IImageProcessor imageProcessor, MediaSettings mediaSettings, Site currentSite, SiteSettings siteSettings)
 {
     _session = session;
     _fileSystem = fileSystem;
     _imageProcessor = imageProcessor;
     _mediaSettings = mediaSettings;
     _currentSite = currentSite;
     _siteSettings = siteSettings;
 }
Пример #3
0
 public FileAdminService(IFileService fileService, ISession session,
     IStringResourceProvider stringResourceProvider, IDocumentService documentService,
     MediaSettings mediaSettings)
 {
     _fileService = fileService;
     _session = session;
     _stringResourceProvider = stringResourceProvider;
     _documentService = documentService;
     _mediaSettings = mediaSettings;
 }
Пример #4
0
 public MediaSettingsTests()
 {
     _mediaSettings = new MediaSettings
                             {
                                 ThumbnailImageHeight = 64,
                                 ThumbnailImageWidth = 64,
                                 SmallImageHeight = 150,
                                 SmallImageWidth = 200,
                                 MediumImageHeight = 240,
                                 MediumImageWidth = 320,
                                 LargeImageHeight = 480,
                                 LargeImageWidth = 640,
                                 MaxImageSizeHeight = 1024,
                                 MaxImageSizeWidth = 1024
                             };
 }
Пример #5
0
        private FileService GetFileService(ISession session = null, IFileSystem fileSystem = null)
        {
            _fileSystem = A.Fake<IFileSystem>();

            _mediaSettings = new MediaSettings
                                {
                                    LargeImageHeight = 480,
                                    LargeImageWidth = 640,
                                    MediumImageHeight = 200,
                                    MediumImageWidth = 320,
                                    SmallImageHeight = 75,
                                    SmallImageWidth = 100,
                                    ThumbnailImageHeight = 64,
                                    ThumbnailImageWidth = 64
                                };
            _siteSettings = new SiteSettings();
            return new FileService(session ?? Session, fileSystem ?? _fileSystem,
                                   A.Fake<IImageProcessor>(), _mediaSettings, CurrentSite, _siteSettings);
        }
Пример #6
0
        public void Initialize(InstallModel model)
        {
            CurrentRequestData.CurrentSite = _site = _session.Get<Site>(_site.Id);
            SetupTasks();
            var siteSettings = new SiteSettings
            {
                TimeZone = model.TimeZone,
                UICulture = model.UiCulture,
                EnableInlineEditing = true,
                SiteIsLive = true,
                FormRendererType = FormRenderingType.Bootstrap3,

            };
            var mediaSettings = new MediaSettings
            {
                ThumbnailImageHeight = 50,
                ThumbnailImageWidth = 50,
                LargeImageHeight = 800,
                LargeImageWidth = 800,
                MediumImageHeight = 500,
                MediumImageWidth = 500,
                SmallImageHeight = 200,
                SmallImageWidth = 200,
                ResizeQuality = 90,
            };
            var mailSettings = new MailSettings
            {
                Port = 25,
            };
            var fileSystemSettings = new FileSystemSettings
            {
                StorageType = typeof(FileSystem).FullName
            };

            _configurationProvider.SaveSettings(siteSettings);
            _configurationProvider.SaveSettings(mediaSettings);
            _configurationProvider.SaveSettings(mailSettings);
            _configurationProvider.SaveSettings(fileSystemSettings);
        }
Пример #7
0
        public void EnforceMaxSize(ref Stream stream, MediaFile file, MediaSettings mediaSettings)
        {
            if (!mediaSettings.EnforceMaxImageSize)
            {
                return;
            }
            var outputStream = new MemoryStream();
            var instructions = new Instructions {JpegQuality = mediaSettings.ResizeQuality};
            instructions["maxwidth"] = mediaSettings.MaxImageSizeWidth.ToString();
            instructions["maxheight"] = mediaSettings.MaxImageSizeHeight.ToString();
            instructions["autorotate"] = "true";

            ImageBuilder.Current.Build(new ImageJob(stream, outputStream, instructions));

            Stream originalStream = stream;
            stream = outputStream;
            originalStream.Dispose();
        }