Class DefaultMediaUrlProvider
Default media URL provider.
Inheritance
System.Object
Namespace: Umbraco.Cms.Core.Routing
Assembly: Umbraco.Core.dll
Syntax
public class DefaultMediaUrlProvider : IMediaUrlProvider
Constructors
View SourceDefaultMediaUrlProvider(MediaUrlGeneratorCollection, UriUtility)
Declaration
public DefaultMediaUrlProvider(MediaUrlGeneratorCollection mediaPathGenerators, UriUtility uriUtility)
Parameters
Type | Name | Description |
---|---|---|
MediaUrlGeneratorCollection | mediaPathGenerators | |
UriUtility | uriUtility |
DefaultMediaUrlProvider(MediaUrlGeneratorCollection, UriUtility, IUrlAssembler)
Declaration
public DefaultMediaUrlProvider(MediaUrlGeneratorCollection mediaPathGenerators, UriUtility uriUtility, IUrlAssembler urlAssembler)
Parameters
Type | Name | Description |
---|---|---|
MediaUrlGeneratorCollection | mediaPathGenerators | |
UriUtility | uriUtility | |
IUrlAssembler | urlAssembler |
Methods
View SourceGetMediaUrl(IPublishedContent, String, UrlMode, String, Uri)
Gets the URL of a media item.
Declaration
public virtual UrlInfo GetMediaUrl(IPublishedContent content, string propertyAlias, UrlMode mode, string culture, Uri current)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The published content. |
System.String | propertyAlias | The property alias to resolve the URL from. |
UrlMode | mode | The URL mode. |
System.String | culture | The variation language. |
Uri | current | The current absolute URL. |
Returns
Type | Description |
---|---|
UrlInfo | The URL for the media. |
Remarks
The URL is absolute or relative depending on mode
and on current
.
If the media is multi-lingual, gets the URL for the specified culture or, when no culture is specified, the current culture.
The URL provider can ignore the mode and always return an absolute URL, e.g. a cdn URL provider will most likely always return an absolute URL.
If the provider is unable to provide a URL, it returns null
.