• Basics
  • Abyss
  • Web APIs
  • C# & Razor
  • .net API
  • JS & TS API

    Show / Hide Table of Contents

    Interface IResponsiveImage

    A object which contains everything to create HTML for responsive img tags with optimal srcset offering all the sizes you may need.

    You can simply add this object to the source, like @image to render the image - which is the same as @image.ImgTag

    Namespace: ToSic.Sxc.Images
    Assembly: ToSic.Sxc.dll
    Syntax
    [PublicApi]
    public interface IResponsiveImage : IHybridHtmlString, IHtmlString
    Remarks

    History: Released 2sxc 13.10

    Properties

    | Improve this Doc View Source

    Alt

    An Alt-description on the image which is retrieved from (in order of priority):

    1. the Razor code creating this object using the parameter imgAlt
    2. or from image metadata - see Description
    3. or from the Razor code using the parameter imgAltFallback new v15
    Declaration
    string Alt { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Class

    The Class of the image. Usually created from these sources

    • The initial call creating this image tag
    • Resize-Settings which may add classes
    • Rule which determines if the image should crop or not, which may add a class
    Declaration
    string Class { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Description

    Image description from the image Metadata. See also Alt.

    Declaration
    string Description { get; }
    Property Value
    Type Description
    System.String
    • null if no metadata exists
    • "" empty string if metadata exists but no description was given
    • a string containing the added description
    Remarks

    Added in v15

    | Improve this Doc View Source

    Height

    The image height, if it should be set at all. Will be null otherwise.

    Declaration
    string Height { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Img

    The img tag which would normally be added to the page automatically. You can also use the normal RazorBlade API and do things like .Alt("description") etc. See also the RazorBlade Img docs

    Declaration
    Img Img { get; }
    Property Value
    Type Description
    ToSic.Razor.Html5.Img
    | Improve this Doc View Source

    ShowAll

    Determines if the image should be shown entirely. This usually means that the image is a logo or something, so cropping was not an option. This also usually means that the aspect ratio / height may be different than expected

    Declaration
    bool ShowAll { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Sizes

    The sizes in case you need it in your custom img-tag. It will only be used for normal img tags, but not for img tags inside picture tags.

    Declaration
    string Sizes { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Src

    The main url, used for main src property

    Declaration
    string Src { get; }
    Property Value
    Type Description
    System.String
    Remarks

    Added in v13.11

    | Improve this Doc View Source

    SrcSet

    The SrcSet in case you need to use it in your own custom img-tag. Note that it will be null if the image has no reason to have a srcset.

    It will only be used for normal img tags, but not for img tags inside picture tags.

    Declaration
    string SrcSet { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Width

    The image width, if it should be set at all. Will be null otherwise.

    Declaration
    string Width { get; }
    Property Value
    Type Description
    System.String
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX