Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
hyva-themes avatar

Hyva Render Media Image

  • 791 installs
  • 78 repo stars
  • Updated July 31, 2026
  • hyva-themes/hyva-ai-tools

hyva-render-media-image is a Frontend Development skill that generates responsive image markup using the Hyvä Theme Media view model for developers who need picture elements and srcset breakpoints without hand-writing Hy

About

hyva-render-media-image is a hyva-themes/hyva-ai-tools skill for producing correct responsive image code in Hyvä Theme templates via the \Hyva\Theme\ViewModel\Media view model. Instead of manually crafting picture elements, srcset lists, and mobile-desktop breakpoints, the skill emits Hyvä-native markup for hero images, product photos, responsive banners, and template images triggered by phrases like render image, picture element, or banner image. Developers reach for hyva-render-media-image when building Magento 2 storefronts on Hyvä and need accessible, breakpoint-aware images that follow the theme's Media API. The skill targets PHTML or template additions where wrong srcset syntax breaks LCP on product and category pages.

  • Generates responsive <picture> elements for Hyvä PHTML templates
  • Uses \Hyva\Theme\ViewModel\Media view model for optimal image rendering
  • Supports hero/LCP images with eager loading and below-fold lazy loading
  • Handles direct image paths or PHP variables as input
  • Optimizes for Core Web Vitals including LCP and CLS

Hyva Render Media Image by the numbers

  • 791 all-time installs (skills.sh)
  • +31 installs in the week ending Aug 2, 2026 (Skillselion tracking)
  • Ranked #443 of 2,245 Frontend Development skills by installs in the Skillselion catalog
  • Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/hyva-themes/hyva-ai-tools --skill hyva-render-media-image

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs791
repo stars78
Last updatedJuly 31, 2026
Repositoryhyva-themes/hyva-ai-tools

How do you render responsive images in Hyvä?

Generate correct responsive image markup using the Hyvä Theme Media view model without manually writing picture elements or srcset attributes.

Who is it for?

Magento 2 developers on Hyvä Theme adding product, hero, or banner images who want correct Media view model markup instead of raw HTML picture tags.

Skip if: Luma or non-Hyvä Magento themes, React image components, or projects outside Hyvä's \Hyva\Theme\ViewModel\Media API.

When should I use this skill?

The user asks to render an image in a Hyvä template, add a hero or banner image, or create responsive picture elements with mobile and desktop breakpoints.

What you get

Hyvä template snippets with picture elements, srcset attributes, and Media view model calls for mobile and desktop breakpoints.

  • Responsive picture template snippets

Files

SKILL.mdMarkdownGitHub ↗

Hyvä Render Image

Generate responsive <picture> elements for Hyvä Theme templates using the \Hyva\Theme\ViewModel\Media view model.

When to Use

  • Adding images to Hyvä PHTML templates
  • Creating responsive images with different sources for mobile/desktop
  • Implementing hero banners, product images, or CMS content images
  • Optimizing images for Core Web Vitals (LCP, CLS)

Workflow

1. Gather Image Requirements

The user may provide image data in one of these ways:

Option A: Direct values - Ask the user for: 1. Image path(s) - Location in pub/media/ (e.g., wysiwyg/hero.jpg, catalog/product/...) 2. Image dimensions - Width and height in pixels 3. Responsive requirements - Different images for mobile vs desktop? 4. Image purpose - Hero/LCP image (eager loading) or below-fold (lazy loading)? 5. Alt text - Meaningful description for accessibility

Option B: PHP variable - The user provides a variable name (e.g., $imageData, $heroImage). Inform the user of the required array structure documented in references/rendering-images.md under ## Image Configuration Format.

2. Generate the Code

Refer to references/rendering-images.md for the complete API reference, code examples, and all configuration options.

Choose the appropriate pattern:

ScenarioPattern to Use
Single image, literal valuesSingle Image Example
Single image from variableWrap in array: [$imageData]
Multiple images from variablePass directly: $images
Different images for mobile/desktopResponsive Images with Media Queries
Need to style the <picture> wrapperPicture Element Attributes

Base template:

<?php
/** @var \Hyva\Theme\ViewModel\Media $mediaViewModel */
$mediaViewModel = $viewModels->require(\Hyva\Theme\ViewModel\Media::class);

echo $mediaViewModel->getResponsivePictureHtml(
    $images,        // Array of image configs (see reference for format)
    $imgAttributes, // Optional: alt, class, loading, fetchpriority
    $pictureAttributes // Optional: class, data-* attributes for <picture>
);

3. Set Loading Strategy

Image TypeAttributes
Hero/LCP (above fold)'loading' => 'eager', 'fetchpriority' => 'high'
Below fold'loading' => 'lazy'

Resources

  • references/rendering-images.md - Complete API reference with method signature, all configuration options, code examples, and best practices

<!-- Copyright © Hyvä Themes https://hyva.io. All rights reserved. Licensed under OSL 3.0 -->

Related skills

FAQ

What view model does hyva-render-media-image use?

The hyva-render-media-image skill generates responsive picture markup through Hyvä Theme's \Hyva\Theme\ViewModel\Media view model, producing correct srcset and breakpoint attributes for templates.

Which image types does the Hyvä image skill cover?

The hyva-render-media-image skill handles hero images, product photos, responsive banners, and general template images with mobile and desktop breakpoints in Hyvä Theme PHTML files.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.