Class DefaultMediaUrlProvider
Default media URL provider.
Inheritance
System.Object
Namespace: Umbraco.Web.Routing
Assembly: Umbraco.Web.dll
Syntax
public class DefaultMediaUrlProvider : IMediaUrlProvider
Constructors
View SourceDefaultMediaUrlProvider()
Declaration
[Obsolete("Use the constructor with all parameters instead")]
public DefaultMediaUrlProvider()
DefaultMediaUrlProvider(PropertyEditorCollection)
Declaration
public DefaultMediaUrlProvider(PropertyEditorCollection propertyEditors)
Parameters
Type | Name | Description |
---|---|---|
PropertyEditorCollection | propertyEditors |
Methods
View SourceGetMediaUrl(UmbracoContext, IPublishedContent, String, UrlMode, String, Uri)
Gets the URL of a media item.
Declaration
public virtual UrlInfo GetMediaUrl(UmbracoContext umbracoContext, IPublishedContent content, string propertyAlias, UrlMode mode, string culture, Uri current)
Parameters
Type | Name | Description |
---|---|---|
UmbracoContext | umbracoContext | The Umbraco context. |
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. |
System.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
.