public TinyMCEWebControl() : base() { _fs = FileSystemProviderManager.Current.GetFileSystemProvider <MediaFileSystem>(); base.TextMode = TextBoxMode.MultiLine; base.Attributes.Add("style", "visibility: hidden"); config.Add("mode", "exact"); config.Add("theme", "umbraco"); config.Add("umbraco_path", global::Umbraco.Core.IO.IOHelper.ResolveUrl(global::Umbraco.Core.IO.SystemDirectories.Umbraco)); CssClass = "tinymceContainer"; plugin.ConfigSection configSection = (plugin.ConfigSection)System.Web.HttpContext.Current.GetSection("TinyMCE"); if (configSection != null) { this.installPath = configSection.InstallPath; this.mode = configSection.Mode; this.gzipEnabled = configSection.GzipEnabled; // Copy items into local config collection foreach (string key in configSection.GlobalSettings.Keys) { this.config[key] = configSection.GlobalSettings[key]; } } else { configSection = new plugin.ConfigSection(); configSection.GzipExpiresOffset = TimeSpan.FromDays(10).Ticks; this.gzipEnabled = false; this.InstallPath = umbraco.editorControls.tinymce.tinyMCEConfiguration.JavascriptPath; } }
private static string DoResize(MediaFileSystem fileSystem, string path, string extension, int width, int height, int maxWidthHeight, string fileNameAddition) { var fs = fileSystem.OpenFile(path); var image = Image.FromStream(fs); fs.Close(); string fileNameThumb = String.IsNullOrEmpty(fileNameAddition) ? string.Format("{0}_UMBRACOSYSTHUMBNAIL.jpg", path.Substring(0, path.LastIndexOf("."))) : string.Format("{0}_{1}.jpg", path.Substring(0, path.LastIndexOf(".")), fileNameAddition); var thumb = GenerateThumbnail(fileSystem, image, maxWidthHeight, width, height, path, extension, fileNameThumb, maxWidthHeight == 0); fileNameThumb = thumb.Item3; image.Dispose(); return(fileNameThumb); }
public ImageInfo(string relativePath) { _fs = FileSystemProviderManager.Current.GetFileSystemProvider <MediaFileSystem>(); try { RelativePath = relativePath; //This get's the IFileSystem's path based on the URL (i.e. /media/blah/blah.jpg ) Path = _fs.GetRelativePath(relativePath); using (var stream = _fs.OpenFile(Path)) using (image = Image.FromStream(stream)) { var fileName = _fs.GetFileName(Path); Name = fileName.Substring(0, fileName.LastIndexOf('.')); DateStamp = _fs.GetLastModified(Path).Date; Width = image.Width; Height = image.Height; Aspect = (float)Width / Height; } } catch (Exception) { Width = 0; Height = 0; Aspect = 0; } }
private void SavingMedia(IMediaService sender, SaveEventArgs <IMedia> e) { MediaFileSystem mediaFileSystem = FileSystemProviderManager.Current.GetFileSystemProvider <MediaFileSystem>(); IContentSection contentSection = UmbracoConfig.For.UmbracoSettings().Content; IEnumerable <string> supportedTypes = contentSection.ImageFileTypes.ToList(); foreach (var entity in e.SavedEntities) { if (!entity.HasProperty("umbracoFile")) { continue; } var path = entity.GetValue <string>("umbracoFile"); var extension = Path.GetExtension(path)?.Substring(1); if (!supportedTypes.InvariantContains(extension)) { continue; } var fullPath = mediaFileSystem.GetFullPath(path); using (ImageFactory imageFactory = new ImageFactory(true)) { ResizeLayer layer = new ResizeLayer(new Size(1920, 0), ResizeMode.Max) { Upscale = false }; imageFactory.Load(fullPath) .Resize(layer) .Save(fullPath); } } }
public string GetTextFromAllPages(string pdfPath, MediaFileSystem mediaFileSystem, Action <Exception> onError) { var output = new StringWriter(); try { using (var stream = mediaFileSystem.OpenFile(pdfPath)) using (var reader = new PdfReader(stream)) { for (int i = 1; i <= reader.NumberOfPages; i++) { var result = ExceptChars( PdfTextExtractor.GetTextFromPage(reader, i, new SimpleTextExtractionStrategy()), UnsupportedRange.Value, ReplaceWithSpace); output.Write(result + " "); } } } catch (Exception ex) { onError(ex); } return(output.ToString()); }
public UmbracoFile(string path) { _fs = FileSystemProviderManager.Current.GetFileSystemProvider <MediaFileSystem>(); _path = path; initialize(); }
public void Can_Generate_Xml_Representation_Of_Media() { // Arrange var mediaType = MockedContentTypes.CreateImageMediaType("image2"); ServiceContext.MediaTypeService.Save(mediaType); // reference, so static ctor runs, so event handlers register // and then, this will reset the width, height... because the file does not exist, of course ;-( var logger = Mock.Of <ILogger>(); var scheme = Mock.Of <IMediaPathScheme>(); var config = Mock.Of <IContentSection>(); var mediaFileSystem = new MediaFileSystem(Mock.Of <IFileSystem>(), config, scheme, logger); var ignored = new FileUploadPropertyEditor(Mock.Of <ILogger>(), mediaFileSystem, config); var media = MockedMedia.CreateMediaImage(mediaType, -1); media.WriterId = -1; // else it's zero and that's not a user and it breaks the tests ServiceContext.MediaService.Save(media, Constants.Security.SuperUserId); // so we have to force-reset these values because the property editor has cleared them media.SetValue(Constants.Conventions.Media.Width, "200"); media.SetValue(Constants.Conventions.Media.Height, "200"); media.SetValue(Constants.Conventions.Media.Bytes, "100"); media.SetValue(Constants.Conventions.Media.Extension, "png"); var nodeName = media.ContentType.Alias.ToSafeAliasWithForcingCheck(); var urlName = media.GetUrlSegment(new[] { new DefaultUrlSegmentProvider() }); // Act XElement element = media.ToXml(); // Assert Assert.That(element, Is.Not.Null); Assert.That(element.Name.LocalName, Is.EqualTo(nodeName)); Assert.AreEqual(media.Id.ToString(), (string)element.Attribute("id")); Assert.AreEqual(media.ParentId.ToString(), (string)element.Attribute("parentID")); Assert.AreEqual(media.Level.ToString(), (string)element.Attribute("level")); Assert.AreEqual(media.SortOrder.ToString(), (string)element.Attribute("sortOrder")); Assert.AreEqual(media.CreateDate.ToString("s"), (string)element.Attribute("createDate")); Assert.AreEqual(media.UpdateDate.ToString("s"), (string)element.Attribute("updateDate")); Assert.AreEqual(media.Name, (string)element.Attribute("nodeName")); Assert.AreEqual(urlName, (string)element.Attribute("urlName")); Assert.AreEqual(media.Path, (string)element.Attribute("path")); Assert.AreEqual("", (string)element.Attribute("isDoc")); Assert.AreEqual(media.ContentType.Id.ToString(), (string)element.Attribute("nodeType")); Assert.AreEqual(media.GetCreatorProfile(ServiceContext.UserService).Name, (string)element.Attribute("writerName")); Assert.AreEqual(media.CreatorId.ToString(), (string)element.Attribute("writerID")); Assert.IsNull(element.Attribute("template")); Assert.AreEqual(media.Properties[Constants.Conventions.Media.File].GetValue().ToString(), element.Elements(Constants.Conventions.Media.File).Single().Value); Assert.AreEqual(media.Properties[Constants.Conventions.Media.Width].GetValue().ToString(), element.Elements(Constants.Conventions.Media.Width).Single().Value); Assert.AreEqual(media.Properties[Constants.Conventions.Media.Height].GetValue().ToString(), element.Elements(Constants.Conventions.Media.Height).Single().Value); Assert.AreEqual(media.Properties[Constants.Conventions.Media.Bytes].GetValue().ToString(), element.Elements(Constants.Conventions.Media.Bytes).Single().Value); Assert.AreEqual(media.Properties[Constants.Conventions.Media.Extension].GetValue().ToString(), element.Elements(Constants.Conventions.Media.Extension).Single().Value); }
public void CanConvertImageCropperPropertyEditor(string val1, string val2, bool expected) { try { var container = RegisterFactory.Create(); var composition = new Composition(container, new TypeLoader(), Mock.Of <IProfilingLogger>(), ComponentTests.MockRuntimeState(RuntimeLevel.Run)); composition.WithCollectionBuilder <PropertyValueConverterCollectionBuilder>(); Current.Factory = composition.CreateFactory(); var logger = Mock.Of <ILogger>(); var scheme = Mock.Of <IMediaPathScheme>(); var config = Mock.Of <IContentSection>(); var mediaFileSystem = new MediaFileSystem(Mock.Of <IFileSystem>(), config, scheme, logger); var imageCropperConfiguration = new ImageCropperConfiguration() { Crops = new[] { new ImageCropperConfiguration.Crop() { Alias = "thumb", Width = 100, Height = 100 } } }; var dataTypeService = new TestObjects.TestDataTypeService( new DataType(new ImageCropperPropertyEditor(Mock.Of <ILogger>(), mediaFileSystem, Mock.Of <IContentSection>(), Mock.Of <IDataTypeService>())) { Id = 1, Configuration = imageCropperConfiguration }); var factory = new PublishedContentTypeFactory(Mock.Of <IPublishedModelFactory>(), new PropertyValueConverterCollection(Array.Empty <IPropertyValueConverter>()), dataTypeService); var converter = new ImageCropperValueConverter(); var result = converter.ConvertSourceToIntermediate(null, factory.CreatePropertyType("test", 1), val1, false); // does not use type for conversion var resultShouldMatch = val2.DeserializeImageCropperValue(); if (expected) { Assert.AreEqual(resultShouldMatch, result); } else { Assert.AreNotEqual(resultShouldMatch, result); } } finally { Current.Reset(); } }
private static Tuple <int, int> GetDimensions(MediaFileSystem fileSystem, string path) { var fs = fileSystem.OpenFile(path); var image = Image.FromStream(fs); var fileWidth = image.Width; var fileHeight = image.Height; fs.Close(); image.Dispose(); return(new Tuple <int, int>(fileWidth, fileHeight)); }
private static ResizedImage Resize(MediaFileSystem fileSystem, string path, string extension, int maxWidthHeight, string fileNameAddition, Image originalImage) { var fileNameThumb = String.IsNullOrEmpty(fileNameAddition) ? string.Format("{0}_UMBRACOSYSTHUMBNAIL.jpg", path.Substring(0, path.LastIndexOf("."))) : string.Format("{0}_{1}.jpg", path.Substring(0, path.LastIndexOf(".")), fileNameAddition); var thumb = GenerateThumbnail(fileSystem, originalImage, maxWidthHeight, extension, fileNameThumb, maxWidthHeight == 0); return(thumb); }
/// <summary> /// Provides the means to extract the text to be indexed from the file specified /// </summary> /// <param name="filePath"></param> /// <param name="mediaFileSystem"></param> /// <returns></returns> protected virtual string ExtractTextFromFile(string filePath, MediaFileSystem mediaFileSystem) { var fileExtension = mediaFileSystem.GetExtension(filePath); if (!SupportedExtensions.Select(x => x.ToUpper()).Contains(fileExtension.ToUpper())) { throw new NotSupportedException("The file with the extension specified is not supported"); } var pdf = new PDFParser(); Action <Exception> onError = (e) => OnIndexingError(new IndexingErrorEventArgs("Could not read PDF", -1, e)); var txt = pdf.GetTextFromAllPages(filePath, mediaFileSystem, onError); return(txt); }
void MediaService_Saving(IMediaService mediaService, SaveEventArgs <IMedia> args) { // Don't allow upload in root if (args.SavedEntities.Any() && args.SavedEntities.First().ParentId == -1 && args.SavedEntities.First().HasProperty("umbracoFile")) { LogHelper.Warn(this.GetType(), "Files are not allowed to be uploaded in the root folder"); args.Cancel = true; return; } MediaFileSystem mediaFileSystem = FileSystemProviderManager.Current.GetFileSystemProvider <MediaFileSystem>(); IContentSection contentSection = UmbracoConfig.For.UmbracoSettings().Content; IEnumerable <string> supportedTypes = contentSection.ImageFileTypes.ToList(); foreach (IMedia media in args.SavedEntities) { if (media.HasProperty("umbracoFile")) { // Make sure it's an image. string path = media.GetValue <string>("umbracoFile"); var fullExtension = Path.GetExtension(path); if (fullExtension != null) { string extension = fullExtension.Substring(1); if (supportedTypes.InvariantContains(extension)) { // Get maxwidth from parent folder var maxWidth = GetMaxWidthFromParent(DefaultMaxWidth, media); if (maxWidth < media.GetValue <int>("umbracoWidth")) { // Resize the image to maxWidth:px wide, height is driven by the aspect ratio of the image. string fullPath = mediaFileSystem.GetFullPath(path); using (ImageFactory imageFactory = new ImageFactory(true)) { ResizeLayer layer = new ResizeLayer(new Size(maxWidth, 0), resizeMode: ResizeMode.Max, anchorPosition: AnchorPosition.Center, upscale: false); imageFactory.Load(fullPath).Resize(layer).Save(fullPath); } } } } } } }
protected override void ScopeExitCompleted() { // processing only the last instance of each event... // this is probably far from perfect, because if eg a content is saved in a list // and then as a single content, the two events will probably not be de-duplicated, // but it's better than nothing foreach (var e in GetEvents(EventDefinitionFilter.LastIn)) { e.RaiseEvent(); // separating concerns means that this should probably not be here, // but then where should it be (without making things too complicated)? var delete = e.Args as IDeletingMediaFilesEventArgs; if (delete != null && delete.MediaFilesToDelete.Count > 0) { MediaFileSystem.DeleteMediaFiles(delete.MediaFilesToDelete); } } }
private MediaResizeItem ResizeImage(IMedia image, string path, MediaFileSystem mediaFileSystem, int count, int imagesCount, out long size) { using (ImageFactory imageFactory = new ImageFactory(true)) { var fullPath = mediaFileSystem.GetFullPath(path); ResizeLayer layer = new ResizeLayer(new Size(330, 0), ResizeMode.Max) { Upscale = false }; var process = imageFactory.Load(fullPath) .Resize(layer) .Save(fullPath); var msg = "\r\n" + image.Name + " (Id: " + image.Id + ") - Succesfully resized \r\n" + "Original size: " + image.GetValue <string>("umbracoWidth") + "px x " + image.GetValue <string>("umbracoHeight") + "px \r\n" + "New size: " + process.Image.Width + "px x " + process.Image.Height + "px \r\n" + "Count: " + count + " of " + imagesCount + "\r\n"; LogHelper.Info <ResizeMediaController>(msg); ApplicationContext.Services.MediaService.Save(image); size = ApplicationContext.Services.MediaService.GetById(image.Id).GetValue <long>("umbracoBytes"); return(new MediaResizeItem { Id = image.Id, Name = image.Name, NewWidth = process.Image.Width + "px", NewHeight = process.Image.Height + "px", OldHeight = image.GetValue <string>("umbracoHeight") + "px", OldWidth = image.GetValue <string>("umbracoWidth") + "px" }); } }
protected UmbracoMediaFactory() { FileSystem = FileSystemProviderManager.Current.GetFileSystemProvider <MediaFileSystem>(); }
protected virtual void ComposeApplication(bool withApplication) { ComposeSettings(); if (withApplication == false) { return; } // default Datalayer/Repositories/SQL/Database/etc... Composition.ComposeRepositories(); // register basic stuff that might need to be there for some container resolvers to work Composition.RegisterUnique(factory => factory.GetInstance <IUmbracoSettingsSection>().Content); Composition.RegisterUnique(factory => factory.GetInstance <IUmbracoSettingsSection>().Templates); Composition.RegisterUnique(factory => factory.GetInstance <IUmbracoSettingsSection>().WebRouting); Composition.RegisterUnique <IExamineManager>(factory => ExamineManager.Instance); // register filesystems Composition.RegisterUnique(factory => TestObjects.GetFileSystemsMock()); var logger = Mock.Of <ILogger>(); var scheme = Mock.Of <IMediaPathScheme>(); var config = Mock.Of <IContentSection>(); var mediaFileSystem = new MediaFileSystem(Mock.Of <IFileSystem>(), config, scheme, logger); Composition.RegisterUnique <IMediaFileSystem>(factory => mediaFileSystem); // no factory (noop) Composition.RegisterUnique <IPublishedModelFactory, NoopPublishedModelFactory>(); // register application stuff (database factory & context, services...) Composition.WithCollectionBuilder <MapperCollectionBuilder>() .AddCoreMappers(); Composition.RegisterUnique <IEventMessagesFactory>(_ => new TransientEventMessagesFactory()); Composition.RegisterUnique <IUmbracoDatabaseFactory>(f => new UmbracoDatabaseFactory( Constants.System.UmbracoConnectionName, Logger, new Lazy <IMapperCollection>(Mock.Of <IMapperCollection>))); Composition.RegisterUnique(f => f.TryGetInstance <IUmbracoDatabaseFactory>().SqlContext); Composition.WithCollectionBuilder <UrlSegmentProviderCollectionBuilder>(); // empty Composition.RegisterUnique(factory => TestObjects.GetScopeProvider(factory.TryGetInstance <ILogger>(), factory.TryGetInstance <FileSystems>(), factory.TryGetInstance <IUmbracoDatabaseFactory>())); Composition.RegisterUnique(factory => (IScopeAccessor)factory.GetInstance <IScopeProvider>()); Composition.ComposeServices(); // composition root is doing weird things, fix Composition.RegisterUnique <IApplicationTreeService, ApplicationTreeService>(); Composition.RegisterUnique <ISectionService, SectionService>(); // somehow property editor ends up wanting this Composition.WithCollectionBuilder <ManifestValueValidatorCollectionBuilder>(); Composition.RegisterUnique <ManifestParser>(); // note - don't register collections, use builders Composition.WithCollectionBuilder <DataEditorCollectionBuilder>(); Composition.RegisterUnique <PropertyEditorCollection>(); Composition.RegisterUnique <ParameterEditorCollection>(); }
/// <summary> /// Gets a ServiceContext. /// </summary> /// <param name="scopeAccessor"></param> /// <param name="cache">A cache.</param> /// <param name="logger">A logger.</param> /// <param name="globalSettings"></param> /// <param name="eventMessagesFactory">An event messages factory.</param> /// <param name="urlSegmentProviders">Some url segment providers.</param> /// <param name="container">A container.</param> /// <param name="scopeProvider"></param> /// <returns>A ServiceContext.</returns> /// <remarks>Should be used sparingly for integration tests only - for unit tests /// just mock the services to be passed to the ctor of the ServiceContext.</remarks> public ServiceContext GetServiceContext( IScopeProvider scopeProvider, IScopeAccessor scopeAccessor, CacheHelper cache, ILogger logger, IGlobalSettings globalSettings, IUmbracoSettingsSection umbracoSettings, IEventMessagesFactory eventMessagesFactory, UrlSegmentProviderCollection urlSegmentProviders, TypeLoader typeLoader, IFactory factory = null) { if (scopeProvider == null) { throw new ArgumentNullException(nameof(scopeProvider)); } if (scopeAccessor == null) { throw new ArgumentNullException(nameof(scopeAccessor)); } if (cache == null) { throw new ArgumentNullException(nameof(cache)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (eventMessagesFactory == null) { throw new ArgumentNullException(nameof(eventMessagesFactory)); } var scheme = Mock.Of <IMediaPathScheme>(); var config = Mock.Of <IContentSection>(); var mediaFileSystem = new MediaFileSystem(Mock.Of <IFileSystem>(), config, scheme, logger); var externalLoginService = GetLazyService <IExternalLoginService>(factory, c => new ExternalLoginService(scopeProvider, logger, eventMessagesFactory, GetRepo <IExternalLoginRepository>(c))); var publicAccessService = GetLazyService <IPublicAccessService>(factory, c => new PublicAccessService(scopeProvider, logger, eventMessagesFactory, GetRepo <IPublicAccessRepository>(c))); var domainService = GetLazyService <IDomainService>(factory, c => new DomainService(scopeProvider, logger, eventMessagesFactory, GetRepo <IDomainRepository>(c))); var auditService = GetLazyService <IAuditService>(factory, c => new AuditService(scopeProvider, logger, eventMessagesFactory, GetRepo <IAuditRepository>(c), GetRepo <IAuditEntryRepository>(c))); var localizedTextService = GetLazyService <ILocalizedTextService>(factory, c => new LocalizedTextService( new Lazy <LocalizedTextServiceFileSources>(() => { var mainLangFolder = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Umbraco + "/config/lang/")); var appPlugins = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.AppPlugins)); var configLangFolder = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Config + "/lang/")); var pluginLangFolders = appPlugins.Exists == false ? Enumerable.Empty <LocalizedTextServiceSupplementaryFileSource>() : appPlugins.GetDirectories() .SelectMany(x => x.GetDirectories("Lang")) .SelectMany(x => x.GetFiles("*.xml", SearchOption.TopDirectoryOnly)) .Where(x => Path.GetFileNameWithoutExtension(x.FullName).Length == 5) .Select(x => new LocalizedTextServiceSupplementaryFileSource(x, false)); //user defined langs that overwrite the default, these should not be used by plugin creators var userLangFolders = configLangFolder.Exists == false ? Enumerable.Empty <LocalizedTextServiceSupplementaryFileSource>() : configLangFolder .GetFiles("*.user.xml", SearchOption.TopDirectoryOnly) .Where(x => Path.GetFileNameWithoutExtension(x.FullName).Length == 10) .Select(x => new LocalizedTextServiceSupplementaryFileSource(x, true)); return(new LocalizedTextServiceFileSources( logger, cache.RuntimeCache, mainLangFolder, pluginLangFolders.Concat(userLangFolders))); }), logger)); var runtimeState = Mock.Of <IRuntimeState>(); var idkMap = new IdkMap(scopeProvider); var localizationService = GetLazyService <ILocalizationService>(factory, c => new LocalizationService(scopeProvider, logger, eventMessagesFactory, GetRepo <IDictionaryRepository>(c), GetRepo <IAuditRepository>(c), GetRepo <ILanguageRepository>(c))); var userService = GetLazyService <IUserService>(factory, c => new UserService(scopeProvider, logger, eventMessagesFactory, runtimeState, GetRepo <IUserRepository>(c), GetRepo <IUserGroupRepository>(c), globalSettings)); var dataTypeService = GetLazyService <IDataTypeService>(factory, c => new DataTypeService(scopeProvider, logger, eventMessagesFactory, GetRepo <IDataTypeRepository>(c), GetRepo <IDataTypeContainerRepository>(c), GetRepo <IAuditRepository>(c), GetRepo <IEntityRepository>(c), GetRepo <IContentTypeRepository>(c))); var contentService = GetLazyService <IContentService>(factory, c => new ContentService(scopeProvider, logger, eventMessagesFactory, mediaFileSystem, GetRepo <IDocumentRepository>(c), GetRepo <IEntityRepository>(c), GetRepo <IAuditRepository>(c), GetRepo <IContentTypeRepository>(c), GetRepo <IDocumentBlueprintRepository>(c), GetRepo <ILanguageRepository>(c))); var notificationService = GetLazyService <INotificationService>(factory, c => new NotificationService(scopeProvider, userService.Value, contentService.Value, localizationService.Value, logger, GetRepo <INotificationsRepository>(c), globalSettings, umbracoSettings.Content)); var serverRegistrationService = GetLazyService <IServerRegistrationService>(factory, c => new ServerRegistrationService(scopeProvider, logger, eventMessagesFactory, GetRepo <IServerRegistrationRepository>(c))); var memberGroupService = GetLazyService <IMemberGroupService>(factory, c => new MemberGroupService(scopeProvider, logger, eventMessagesFactory, GetRepo <IMemberGroupRepository>(c))); var memberService = GetLazyService <IMemberService>(factory, c => new MemberService(scopeProvider, logger, eventMessagesFactory, memberGroupService.Value, mediaFileSystem, GetRepo <IMemberRepository>(c), GetRepo <IMemberTypeRepository>(c), GetRepo <IMemberGroupRepository>(c), GetRepo <IAuditRepository>(c))); var mediaService = GetLazyService <IMediaService>(factory, c => new MediaService(scopeProvider, mediaFileSystem, logger, eventMessagesFactory, GetRepo <IMediaRepository>(c), GetRepo <IAuditRepository>(c), GetRepo <IMediaTypeRepository>(c), GetRepo <IEntityRepository>(c))); var contentTypeService = GetLazyService <IContentTypeService>(factory, c => new ContentTypeService(scopeProvider, logger, eventMessagesFactory, contentService.Value, GetRepo <IContentTypeRepository>(c), GetRepo <IAuditRepository>(c), GetRepo <IDocumentTypeContainerRepository>(c), GetRepo <IEntityRepository>(c))); var mediaTypeService = GetLazyService <IMediaTypeService>(factory, c => new MediaTypeService(scopeProvider, logger, eventMessagesFactory, mediaService.Value, GetRepo <IMediaTypeRepository>(c), GetRepo <IAuditRepository>(c), GetRepo <IMediaTypeContainerRepository>(c), GetRepo <IEntityRepository>(c))); var fileService = GetLazyService <IFileService>(factory, c => new FileService(scopeProvider, logger, eventMessagesFactory, GetRepo <IStylesheetRepository>(c), GetRepo <IScriptRepository>(c), GetRepo <ITemplateRepository>(c), GetRepo <IPartialViewRepository>(c), GetRepo <IPartialViewMacroRepository>(c), GetRepo <IAuditRepository>(c))); var memberTypeService = GetLazyService <IMemberTypeService>(factory, c => new MemberTypeService(scopeProvider, logger, eventMessagesFactory, memberService.Value, GetRepo <IMemberTypeRepository>(c), GetRepo <IAuditRepository>(c), GetRepo <IEntityRepository>(c))); var entityService = GetLazyService <IEntityService>(factory, c => new EntityService( scopeProvider, logger, eventMessagesFactory, contentService.Value, contentTypeService.Value, mediaService.Value, mediaTypeService.Value, dataTypeService.Value, memberService.Value, memberTypeService.Value, idkMap, GetRepo <IEntityRepository>(c))); var macroService = GetLazyService <IMacroService>(factory, c => new MacroService(scopeProvider, logger, eventMessagesFactory, GetRepo <IMacroRepository>(c), GetRepo <IAuditRepository>(c))); var packagingService = GetLazyService <IPackagingService>(factory, c => new PackagingService(logger, contentService.Value, contentTypeService.Value, mediaService.Value, macroService.Value, dataTypeService.Value, fileService.Value, localizationService.Value, entityService.Value, userService.Value, scopeProvider, urlSegmentProviders, GetRepo <IAuditRepository>(c), GetRepo <IContentTypeRepository>(c), new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty <DataEditor>())))); var relationService = GetLazyService <IRelationService>(factory, c => new RelationService(scopeProvider, logger, eventMessagesFactory, entityService.Value, GetRepo <IRelationRepository>(c), GetRepo <IRelationTypeRepository>(c))); var treeService = GetLazyService <IApplicationTreeService>(factory, c => new ApplicationTreeService(logger, cache, typeLoader)); var tagService = GetLazyService <ITagService>(factory, c => new TagService(scopeProvider, logger, eventMessagesFactory, GetRepo <ITagRepository>(c))); var sectionService = GetLazyService <ISectionService>(factory, c => new SectionService(userService.Value, treeService.Value, scopeProvider, cache)); var redirectUrlService = GetLazyService <IRedirectUrlService>(factory, c => new RedirectUrlService(scopeProvider, logger, eventMessagesFactory, GetRepo <IRedirectUrlRepository>(c))); var consentService = GetLazyService <IConsentService>(factory, c => new ConsentService(scopeProvider, logger, eventMessagesFactory, GetRepo <IConsentRepository>(c))); return(new ServiceContext( publicAccessService, domainService, auditService, localizedTextService, tagService, contentService, userService, memberService, mediaService, contentTypeService, mediaTypeService, dataTypeService, fileService, localizationService, packagingService, serverRegistrationService, entityService, relationService, treeService, sectionService, macroService, memberTypeService, memberGroupService, notificationService, externalLoginService, redirectUrlService, consentService)); }
public uploadField(IData Data, string ThumbnailSizes) { _fs = FileSystemProviderManager.Current.GetFileSystemProvider <MediaFileSystem>(); _data = (cms.businesslogic.datatype.FileHandlerData)Data; //this is always FileHandlerData _thumbnails = ThumbnailSizes; }
private static Tuple <int, int, string> GenerateThumbnail(MediaFileSystem fileSystem, Image image, int maxWidthHeight, int fileWidth, int fileHeight, string fullFilePath, string extension, string thumbnailFileName, bool useFixedDimensions) { // Generate thumbnail float f = 1; if (!useFixedDimensions) { var fx = (float)image.Size.Width / (float)maxWidthHeight; var fy = (float)image.Size.Height / (float)maxWidthHeight; // must fit in thumbnail size f = Math.Max(fx, fy); //if (f < 1) f = 1; } var widthTh = (int)Math.Round((float)fileWidth / f); int heightTh = (int)Math.Round((float)fileHeight / f); // fixes for empty width or height if (widthTh == 0) { widthTh = 1; } if (heightTh == 0) { heightTh = 1; } // Create new image with best quality settings var bp = new Bitmap(widthTh, heightTh); var g = Graphics.FromImage(bp); g.SmoothingMode = SmoothingMode.HighQuality; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.CompositingQuality = CompositingQuality.HighQuality; // Copy the old image to the new and resized var rect = new Rectangle(0, 0, widthTh, heightTh); g.DrawImage(image, rect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); // Copy metadata var imageEncoders = ImageCodecInfo.GetImageEncoders(); ImageCodecInfo codec = null; if (extension.ToLower() == "png" || extension.ToLower() == "gif") { codec = imageEncoders.Single(t => t.MimeType.Equals("image/png")); } else { codec = imageEncoders.Single(t => t.MimeType.Equals("image/jpeg")); } // Set compresion ratio to 90% var ep = new EncoderParameters(); ep.Param[0] = new EncoderParameter(Encoder.Quality, 90L); // Save the new image using the dimensions of the image string newFileName = thumbnailFileName.Replace("UMBRACOSYSTHUMBNAIL", string.Format("{0}x{1}", widthTh, heightTh)); var ms = new MemoryStream(); bp.Save(ms, codec, ep); ms.Seek(0, 0); fileSystem.AddFile(newFileName, ms); ms.Close(); bp.Dispose(); g.Dispose(); return(new Tuple <int, int, string>(widthTh, heightTh, newFileName)); }
protected UmbracoMetaWeblogAPI() { _fs = FileSystemProviderManager.Current.GetFileSystemProvider <MediaFileSystem>(); }
public HttpResponseMessage ResizeAll() { var count = 0; long size = 0; var stopwatch = new Stopwatch(); var images = GetAllImages(); var oldSize = images.Select(x => x.GetValue <long>("umbracoBytes")).Sum(); var imagesCount = images.Count; var resizedImages = new List <MediaResizeItem>(); stopwatch.Start(); MediaFileSystem mediaFileSystem = FileSystemProviderManager.Current.GetFileSystemProvider <MediaFileSystem>(); IContentSection contentSection = UmbracoConfig.For.UmbracoSettings().Content; IEnumerable <string> supportedTypes = contentSection.ImageFileTypes.ToList(); foreach (var image in images) { var pathStr = image.GetValue <string>("umbracoFile"); if (string.IsNullOrEmpty(pathStr)) { continue; } var path = pathStr.Contains("{") ? JsonConvert.DeserializeObject <UmbracoPath>(pathStr).Src : pathStr; if (string.IsNullOrEmpty(path)) { continue; } var extension = Path.GetExtension(path).Substring(1); if (!supportedTypes.InvariantContains(extension)) { continue; } try { var resizedImage = ResizeImage(image, path, mediaFileSystem, count, imagesCount, out var addedSize); resizedImages.Add(resizedImage); size += addedSize; } catch (Exception e) { var msg = "\r\n" + image.Name + " (Id: " + image.Id + ") - Failed \r\n"; LogHelper.Error <ResizeMediaController>(msg, e); } } stopwatch.Stop(); var retObj = new MediaResult { ResizedMedia = resizedImages, ElapsedTime = stopwatch.Elapsed.Seconds.ToString(), OldSize = oldSize, Size = ConvertBytesToMegabytes(size) }; return(Request.CreateResponse(HttpStatusCode.OK, retObj, new MediaTypeHeaderValue("application/json"))); }
public FileUploadPropertyValueEditor(PropertyValueEditor wrapped, MediaFileSystem mediaFileSystem) : base(wrapped) { _mediaFileSystem = mediaFileSystem; }
public UmbracoFile() { _fs = FileSystemProviderManager.Current.GetFileSystemProvider <MediaFileSystem>(); }
public UploadAutoFillProperties(MediaFileSystem mediaFileSystem, ILogger logger, IContentSection contentSettings) { _mediaFileSystem = mediaFileSystem; _logger = logger; _contentSettings = contentSettings; }
private Property CopyUmbracoFileProperty(Property umbFileProp) { if (umbFileProp.Value == null) { return(umbFileProp); } string imageSource; dynamic umbFile = new { }; bool isPropertyDynamic = false; try { umbFile = JsonConvert.DeserializeObject <dynamic>(umbFileProp.Value.ToString()); imageSource = umbFile.src; isPropertyDynamic = true; } catch (Exception e) { imageSource = umbFileProp.Value.ToString(); } if (String.IsNullOrEmpty(imageSource)) { return(umbFileProp); } string currentFolderName = GetCurrentFolderName(imageSource); string src = imageSource.Replace("/media", ""); if (!VirtualPathUtility.IsAbsolute(src)) { Uri uriImageSource = new Uri(src); src = uriImageSource.PathAndQuery; } try { //Get the media folder number. long newFolderName = GetMediaFolderCount(); //convert the old source into the new image source. string newImageSrc = "/media" + src.Replace(currentFolderName, newFolderName.ToString()); //Get the index of the last /, which should be after the media folder number int lastIndexOfSlash = newImageSrc.LastIndexOf("/"); //Remove the image name from the path. string newImageFolder = newImageSrc.Substring(0, lastIndexOfSlash); //Map the new media folder path to the server. string mappedServerPath = HttpContext.Current.Server.MapPath(newImageFolder); string mappedNewImageSrc = HttpContext.Current.Server.MapPath(newImageSrc); //Create the directory for the new media folder DirectoryInfo di = Directory.CreateDirectory(mappedServerPath); //Get umbracos MediaFileSystem MediaFileSystem fs = FileSystemProviderManager.Current.GetFileSystemProvider <MediaFileSystem>(); //Copy the old image to the new directory. try { //Most likely reason to fail would be that the src file doesn't exist on the filesystem fs.CopyFile(src, mappedNewImageSrc); } catch (Exception e) { //If this failed just take the imageSource and use it as the property value, no use making everything crap out. return(umbFileProp); //Return this because no changes/files were made/created. } //Now set the umbfilesource to the new source. string fullNewImageSource = imageSource.Replace(currentFolderName, newFolderName.ToString()); if (!VirtualPathUtility.IsAbsolute(imageSource)) { //So we are dealing with a full url "https://something.com/bla/blah/blah.png Uri fullUri = new Uri(imageSource); fullNewImageSource = fullUri.GetLeftPart(UriPartial.Authority) + fullNewImageSource; } if (isPropertyDynamic) { umbFile.src = fullNewImageSource; umbFileProp.Value = JsonConvert.SerializeObject(umbFile); } else { //its just a string so we can just set the value umbFileProp.Value = fullNewImageSource; } return(umbFileProp); } catch (Exception e) { return(null); } }
public void RegisterRoutes(RouteCollection routes) { var idConstraint = new MinRouteConstraint(1); /* Media * ----------------------------------------*/ // By default IIS handles requests for static files (through its static file handler, even if they don't exist physically), but we don't want that. // Registering the following patterns ensures that MVC catches this requests and passes them to our media controller. // Within this controller we gonna find the actual file and stream it back to the client, // or - in case of blob storage - redirect the client to the computed public url. var mediaPublicPath = MediaFileSystem.GetMediaPublicPath(); Route RegisterMediaRoute(string routeName, string actionName, string url) { return(routes.MapRoute(routeName, mediaPublicPath + url + "/{*path}", new { controller = "Media", action = actionName }, new[] { "SmartStore.Web.Controllers" })); } #region V3 Media legacy routes //// Match URL pattern /{pub}/image/{id}/{path}[?{query}], e.g. '/media/image/234/myproduct.png?size=250' //SmartUrlRoutingModule.RegisterRoutablePath(@"/{0}image/([1-9]\d*|0)/.*?$".FormatInvariant(mediaPublicPath), "GET|HEAD"); //routes.MapRoute("Image", // mediaPublicPath + "image/{id}/{*name}", // new { controller = "Media", action = "Image" }, // //new { id = new MinRouteConstraint(0) }, // Don't bother with this, the Regex matches this already // new[] { "SmartStore.Web.Controllers" }); #endregion #region Media routes // Legacy URL redirection: match URL pattern /{pub}/uploaded/{path}[?{query}], e.g. '/media/uploaded/subfolder/image.png' SmartUrlRoutingModule.RegisterRoutablePath(@"/{0}uploaded/.*?$".FormatInvariant(mediaPublicPath), "GET|HEAD"); RegisterMediaRoute("MediaUploaded", "Uploaded", "uploaded"); // Legacy tenant URL redirection: match URL pattern /{pub}/{tenant}/uploaded/{path}[?{query}], e.g. '/media/default/uploaded/subfolder/image.png' var str = DataSettings.Current.TenantName + "/uploaded"; SmartUrlRoutingModule.RegisterRoutablePath(@"/{0}{1}/.*?$".FormatInvariant(mediaPublicPath, str), "GET|HEAD"); RegisterMediaRoute("MediaUploadedWithTenant", "Uploaded", str); // Legacy media URL redirection: /{pub}/image/{id}/{path}[?{query}], e.g. '/media/image/234/myproduct.png?size=250' SmartUrlRoutingModule.RegisterRoutablePath(@"/{0}image/([1-9]\d*|0)/.*?$".FormatInvariant(mediaPublicPath), "GET|HEAD"); RegisterMediaRoute("MediaImage", "Image", "image"); // Match URL pattern /{pub}/media/{id}/{path}[?{query}], e.g. '/media/234/{album}/myproduct.png?size=250' SmartUrlRoutingModule.RegisterRoutablePath(@"/{0}[0-9]*/.*?$".FormatInvariant(mediaPublicPath), "GET|HEAD"); RegisterMediaRoute("Media", "File", "{id}"); #endregion /* Common * ----------------------------------------*/ routes.MapLocalizedRoute("HomePage", "", new { controller = "Home", action = "Index" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("Register", "register/", new { controller = "Customer", action = "Register" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("Login", "login/", new { controller = "Customer", action = "Login" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("Logout", "logout/", new { controller = "Customer", action = "Logout" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("ContactUs", "contactus", new { controller = "Home", action = "ContactUs" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("ShoppingCart", "cart/", new { controller = "ShoppingCart", action = "Cart" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("Wishlist", "wishlist/{customerGuid}", new { controller = "ShoppingCart", action = "Wishlist", customerGuid = UrlParameter.Optional }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("TopicLegacy", "t/{SystemName}", new { controller = "Topic", action = "TopicDetailsLegacy" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("Search", "search/", new { controller = "Search", action = "Search" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("InstantSearch", "instantsearch", new { controller = "Search", action = "InstantSearch" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("ChangeCurrency", "changecurrency/{customercurrency}", new { controller = "Common", action = "CurrencySelected" }, new { customercurrency = idConstraint }, new[] { "SmartStore.Web.Controllers" }); routes.MapRoute("ChangeLanguage", "changelanguage/{langid}", new { controller = "Common", action = "SetLanguage" }, new { langid = idConstraint }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("ChangeTaxType", "changetaxtype/{customertaxtype}", new { controller = "Common", action = "TaxTypeSelected" }, new { customertaxtype = idConstraint }, new[] { "SmartStore.Web.Controllers" }); /* Catalog * ----------------------------------------*/ routes.MapLocalizedRoute("ManufacturerList", "manufacturer/all/", new { controller = "Catalog", action = "ManufacturerAll" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("ProductsByTag", "producttag/{productTagId}/{*path}", new { controller = "Catalog", action = "ProductsByTag" }, new { productTagId = idConstraint }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("ProductTagsAll", "producttag/all/", new { controller = "Catalog", action = "ProductTagsAll" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("RecentlyViewedProducts", "recentlyviewedproducts/", new { controller = "Catalog", action = "RecentlyViewedProducts" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("RecentlyAddedProducts", "newproducts/", new { controller = "Catalog", action = "RecentlyAddedProducts" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("RecentlyAddedProductsRSS", "newproducts/rss", new { controller = "Catalog", action = "RecentlyAddedProductsRss" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("CompareProducts", "compareproducts/", new { controller = "Catalog", action = "CompareProducts" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("CookieManager", "cookiemanager/", new { controller = "Common", action = "CookieManager" }, new[] { "SmartStore.Web.Controllers" }); /* Shopping Cart * ----------------------------------------*/ // add product to cart (without any attributes and options). used on catalog pages. routes.MapLocalizedRoute("AddProductToCartSimple", "cart/addproductsimple/{productId}", new { controller = "ShoppingCart", action = "AddProductSimple" }, new { productId = idConstraint }, new[] { "SmartStore.Web.Controllers" }); // add product to cart (with attributes and options). used on the product details pages. routes.MapLocalizedRoute("AddProductToCart", "cart/addproduct/{productId}/{shoppingCartTypeId}", new { controller = "ShoppingCart", action = "AddProduct" }, new { productId = idConstraint, shoppingCartTypeId = idConstraint }, new[] { "SmartStore.Web.Controllers" }); /* Checkout * ----------------------------------------*/ routes.MapLocalizedRoute("Checkout", "checkout/", new { controller = "Checkout", action = "Index" }, new[] { "SmartStore.Web.Controllers" }); /* Newsletter * ----------------------------------------*/ routes.MapLocalizedRoute("NewsletterActivation", "newsletter/subscriptionactivation/{token}/{active}", new { controller = "Newsletter", action = "SubscriptionActivation" }, new { token = new GuidConstraint(false) }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("SubscribeNewsletter", // COMPAT: subscribenewsletter >> newsletter/subscribe "Newsletter/Subscribe", new { controller = "Newsletter", action = "Subscribe" }, new[] { "SmartStore.Web.Controllers" }); /* Customer * ----------------------------------------*/ routes.MapLocalizedRoute("AccountActivation", "customer/activation", new { controller = "Customer", action = "AccountActivation" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("CustomerProfile", "profile/{id}", new { controller = "Profile", action = "Index", id = UrlParameter.Optional }, new { id = idConstraint }, new[] { "SmartStore.Web.Controllers" }); /* Blog * ----------------------------------------*/ routes.MapLocalizedRoute("Blog", "blog", new { controller = "Blog", action = "List" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("BlogByTag", "blog/tag/{tag}", new { controller = "Blog", action = "BlogByTag" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("BlogByMonth", "blog/month/{month}", new { controller = "Blog", action = "BlogByMonth" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("BlogRSS", "blog/rss/{languageId}", new { controller = "Blog", action = "ListRss", languageId = UrlParameter.Optional }, new[] { "SmartStore.Web.Controllers" }); /* Boards * ----------------------------------------*/ routes.MapLocalizedRoute("Boards", "boards", new { controller = "Boards", action = "Index" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("BoardPostCreate", "boards/postcreate/{id}/{quote}", new { controller = "Boards", action = "PostCreate", quote = UrlParameter.Optional }, new { id = idConstraint }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("TopicSlug", "boards/topic/{id}/{slug}", new { controller = "Boards", action = "Topic", slug = UrlParameter.Optional }, new { id = idConstraint }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("TopicSlugPaged", "boards/topic/{id}/{slug}/page/{page}", new { controller = "Boards", action = "Topic" }, new { id = idConstraint, page = idConstraint }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("ForumSlug", "boards/forum/{id}/{slug}", new { controller = "Boards", action = "Forum", slug = UrlParameter.Optional }, new { id = idConstraint }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("ForumSlugPaged", "boards/forum/{id}/{slug}/page/{page}", new { controller = "Boards", action = "Forum" }, new { id = idConstraint, page = idConstraint }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("ForumGroupSlug", "boards/forumgroup/{id}/{slug}", new { controller = "Boards", action = "ForumGroup", slug = UrlParameter.Optional }, new { id = idConstraint }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("BoardSearch", "boards/search", new { controller = "Boards", action = "Search" }, new[] { "SmartStore.Web.Controllers" }); /* Misc * ----------------------------------------*/ routes.MapLocalizedRoute("RegisterResult", "registerresult/{resultId}", new { controller = "Customer", action = "RegisterResult" }, new { resultId = idConstraint }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("PrivateMessages", "privatemessages/{tab}", new { controller = "PrivateMessages", action = "Index", tab = UrlParameter.Optional }, new { tab = @"inbox|sent" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("NewsArchive", "news", new { controller = "News", action = "List" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("NewsRss", "news/rss/{languageId}", new { controller = "News", action = "rss", languageId = UrlParameter.Optional }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("Sitemap", "sitemap", new { controller = "Home", action = "Sitemap" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("XmlSitemap", "sitemap.xml", new { controller = "Media", action = "XmlSitemap" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("StoreClosed", "storeclosed", new { controller = "Home", action = "StoreClosed" }, new[] { "SmartStore.Web.Controllers" }); routes.MapRoute("robots.txt", "robots.txt", new { controller = "Common", action = "RobotsTextFile" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("Settings", "settings", new { controller = "Common", action = "Settings" }, new[] { "SmartStore.Web.Controllers" }); }
private static string Resize(MediaFileSystem fileSystem, string path, string extension, int maxWidthHeight, string fileNameAddition) { var fileNameThumb = DoResize(fileSystem, path, extension, GetDimensions(fileSystem, path).Item1, GetDimensions(fileSystem, path).Item2, maxWidthHeight, fileNameAddition); return(fileSystem.GetUrl(fileNameThumb)); }
public uploadField(IData Data, string ThumbnailSizes) { _fs = FileSystemProviderManager.Current.GetFileSystemProvider <MediaFileSystem>(); _data = (cms.businesslogic.datatype.DefaultData)Data; _thumbnails = ThumbnailSizes; }
public mediaService() { _fs = FileSystemProviderManager.Current.GetFileSystemProvider <MediaFileSystem>(); }
public ImageCropperPropertyValueEditor(PropertyValueEditor wrapped, MediaFileSystem mediaFileSystem) : base(wrapped) { _mediaFileSystem = mediaFileSystem; }