Show / Hide Table of Contents

Configuration

Specify settings during initialization

using AdaptiveImages.Configuration;
using AdaptiveImages.Initialization;
using Microsoft.Extensions.DependencyInjection;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddAdaptiveImages(new AddonSettings
        {
            // Default breakpoints unless specified through rendering arguments
            LargeBreakpoint = 1200,
            MediumBreakpoint = 800,

            // Default rendering widths unless specified through rendering arguments (defaults to breakpoint widths if not specified)
            LargeWidth = 1170,
            MediumWidth = 940,
            SmallWidth = 727,

            // The maximum allowed rendering size regardless of rendering arguments
            MaxWidth = 2560,
        });
    }
}

For all available settings, see IAddonSettings.

Translating default form factor names

The default form factor names for AdaptiveImage properties can be localized by adding additional translations.

<?xml version="1.0" encoding="utf-8" ?>
<languages>
    <language name="English" id="en">
        <ContentTypes>
            <AdaptiveImage>
                <properties>
                    <Large>
                        <caption>Desktop</caption>
                    </Large>
                    <Medium>
                        <caption>Tablet</caption>
                    </Medium>
                    <Small>
                        <caption>Mobile</caption>
                    </Small>
                </properties>
            </AdaptiveImage>
        </ContentTypes>
    </language>
</languages>
☀
☾
In this article
Back to top
Documentation applies to: Adaptive Images 2.x
☀
☾