Search Results for

    Show / Hide Table of Contents
    View Source

    Class MediaFileExtensions

    Extension methods for reading the file extension of a media item. Both overloads read the stored file; a slim entity already carries its path, a full media item resolves it.

    Inheritance
    object
    Namespace: Umbraco.Extensions
    Assembly: Umbraco.Core.dll
    Syntax
    public static class MediaFileExtensions

    Methods

    View Source

    GetFileExtension(IMediaEntitySlim)

    Gets the file extension of a media entity, without the leading dot and in lowercase.

    Declaration
    public static string? GetFileExtension(this IMediaEntitySlim entity)
    Parameters
    Type Name Description
    IMediaEntitySlim entity

    The media entity.

    Returns
    Type Description
    string

    The file extension, or null when there is no file.

    View Source

    GetFileExtension(IMedia, MediaUrlGeneratorCollection)

    Gets the file extension of a media item, without the leading dot and in lowercase.

    Declaration
    public static string? GetFileExtension(this IMedia media, MediaUrlGeneratorCollection mediaUrlGenerators)
    Parameters
    Type Name Description
    IMedia media

    The media item.

    MediaUrlGeneratorCollection mediaUrlGenerators

    Used to resolve the stored file's path.

    Returns
    Type Description
    string

    The file extension, or null when there is no file.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX