There is a license error on this site:
License has expired
The Web site remains functional, but this message will be displayed until the license error has been corrected.

To correct this error:If you do not have a license file, please request one from EPiServer License Center.
- Responsive Images Demo
Hero image demonstrating responsive crops across different breakpoints
✨ RESPONSIVE IMAGES ADD-ON

Optimizely CMS 12 - Responsive Images Add-on Demo

Card 1

Card 1

Automatically created card using media image #2.

Card 2

Card 2

Automatically created card using media image #3.

Card 3

Card 3

Automatically created card using media image #4.

Implementation Details

Tag Helper Usage

The hero image above is rendered using the <responsive-image> tag helper:

<responsive-image 
    image="@Model.HeroImage" 
    alt="Hero image demonstrating responsive crops"
    class="hero-image"
    loading="eager"
    decoding="async" />

Generated HTML

The tag helper generates a <picture> element with multiple <source> elements for different breakpoints:

Breakpoint Configuration

📱 Mobile

Aspect Ratio: 4:3 (Portrait-friendly)

Range: 0-767px

Devices: Phones in portrait/landscape

Taller crop optimized for vertical viewports

💻 Tablet

Aspect Ratio: 16:9 (Standard widescreen)

Range: 768-1365px

Devices: All tablets including iPad Pro 12.9"

Classic widescreen for tablet experiences

🖥️ Desktop

Aspect Ratio: 2:1 (Modern wide hero)

Range: 1366px+

Devices: Laptops and desktop monitors

Wide but balanced crop for large screens

Note: Crops are generated from focal point and breakpoint aspect ratios via the add-on services. The sandbox demonstrates the same end-to-end flow used by the add-on model: image selection, crop generation, optional breakpoint adjustments, and persisted rendering.

Page Property Configuration

The StartPage demonstrates both direct attributes and block-based setup:

// Hero image: explicit per-property aspect ratios
[AspectRatio(Breakpoint.Mobile, 4, 3)]
[AspectRatio(Breakpoint.Tablet, 16, 9)]
[AspectRatio(Breakpoint.Desktop, 2, 1)]
public virtual ResponsiveImage HeroImage { get; set; }

// Cards: content area with CardBlock items
[AllowedTypes(typeof(CardBlock))]
public virtual ContentArea CardBlocks { get; set; }

Attribute Explanation

Features Demonstrated

Testing Instructions

To test the responsive hero behavior:

  1. Resize your browser window to see different crops at different viewport sizes
  2. Open DevTools (F12) and check the Network tab to see which breakpoint source is loaded
  3. Inspect the HTML to see the generated picture element and sources
  4. Check responsive mode (F12 → Device toolbar) to test mobile, tablet, and desktop views
  5. In CMS, assign or update image/crop data on HeroImage and CardBlocks and save to verify persisted rendering

What to Look For

Tip: Open DevTools Network tab and resize the browser window. You'll see the requested source switch as you cross breakpoint boundaries. In this MVP demo, each breakpoint uses one generated width with focal-point-driven crop data.