Media Utils provides responsive image rendering for TYPO3 and bundles reusable
Fluid partials and ViewHelpers for working with image and media files.
It can render classic responsive img markup with srcset and sizes
or picture markup with breakpoint-specific source tags. The output is
configured through TYPO3 site sets and TypoScript settings.
Main features
Responsive image rendering with srcset and sizes.
Optional picture tag rendering with configurable breakpoints.
Native lazy loading via loading="lazy".
JavaScript lazy loading support via data-src and data-srcset.
Optional placeholder images, including inline base64 placeholders.
Configurable output file extension, for example WebP.
Configurable ignored file extensions, for example SVG and GIF.
Width limits to avoid unnecessary image upsizing.
TYPO3 v14 batch image processing when available.
Reusable Utils/Media partial for images and videos.
Own Fluid ViewHelpers under the Madj2k\MediaUtils namespace.
File helper ViewHelpers for FAL properties, relations and crop-variant CSS classes.
Default and Bootstrap site sets.
Backend-editable settings via settings.definitions.yaml.
Compatibility with projects migrating from EXT:sms_responsive_images.
Rendering concept
The extension separates the rendering into small services:
the ViewHelpers collect arguments and settings,
the responsive image service prepares image options,
generators create srcset candidates and placeholders,
renderers build img, source and picture tags,
TYPO3's renderer registry is used for non-image media files.
This keeps Fluid templates concise while still allowing detailed control over
individual images or media elements.
Installation
Requirements
Component
Requirement
PHP
8.3 or later
TYPO3
13.4 LTS or 14.4 LTS
PHP extension
fileinfo
Composer installation
Install the extension with Composer:
composer require madj2k/t3-media-utils
Copied!
Site set
Include one of the shipped site sets in your site package configuration.
The Bootstrap set depends on the default set and provides breakpoint-oriented
picture configuration for common Bootstrap breakpoints.
Allow WebP output
When you want to render processed images as WebP, add webp to the allowed
TYPO3 image file extensions in config/system/settings.php or the
respective project configuration:
The site sets register the default TypoScript configuration. For custom
extensions or manually configured Fluid templates, add the partial root path
explicitly when necessary.
Migration
From EXT:sms_responsive_images
Media Utils is designed to be compatible with projects that previously used
EXT:sms_responsive_images. The Composer package declares a replacement for
sitegeist/sms-responsive-images and the TYPO3 extension metadata declares a
conflict with the old extension key.
Include the madj2k/media-utils or madj2k/media-utils-bootstrap site set.
Configure the responsive image defaults in the backend under
Settings > MediaUtils.
Keep existing lib.txMediaUtils.responsiveImages integrations. This is the
documented global TypoScript object for Media Utils.
Replace old sitegeist/sms-responsive-images ViewHelper namespaces with the Media Utils namespace
when templates are touched.
Prefer the bundled Utils/Media partial for new implementations.
Keep compatibility aliases only for existing templates that cannot be migrated
immediately.
Compatibility with older sitegeist/sms-responsive-images-based implementations
Version 14 is compatible with older implementations that previously used Media
Utils together with sitegeist/sms-responsive-images, for example projects based on
version 13 plus sitegeist/sms-responsive-images. Existing settings below
lib.txMediaUtils.responsiveImages and the legacy
tx_smsresponsiveimages settings are still considered during rendering, so
projects can be upgraded first and templates can be migrated step by step.
For new code, use the Media Utils ViewHelpers and namespace directly:
The extension still adds partial paths to lib.maskContentElement for legacy
projects. New implementations should prefer EXT:content-blocks or direct
Fluid template integration.
README audit notes
During documentation creation, the README was checked against the current
extension source. The following points were updated in this manual:
sitegeist/sms-responsive-images ViewHelper examples were removed and replaced with Media Utils ViewHelpers.
Direct ViewHelper examples now use Madj2k\MediaUtils namespaces.
The documented global TypoScript object remains lib.txMediaUtils.responsiveImages.
Features visible in the source but not fully described in the README were added,
including placeholder generation, focus-area metadata, TYPO3 renderer registry
usage for non-image media and file helper ViewHelpers.
Configuration
Media Utils is configured through TYPO3 site sets, backend settings and a
reusable TypoScript lib object. The shipped configuration is intended to be
included in site packages, content blocks, Fluid templates and custom extensions.
The extension ships TYPO3 site sets with ready-to-use responsive image
configuration. These sets expose their options through
settings.definitions.yaml, so project defaults can be adjusted in the
TYPO3 backend.
Available site sets
Site set
Purpose
madj2k/media-utils
Default responsive image configuration.
madj2k/media-utils-bootstrap
Bootstrap-oriented breakpoint configuration for picture output.
Backend settings
After including one of the shipped site sets, the responsive image configuration
can be adjusted in the TYPO3 backend under Settings > MediaUtils.
Use these backend settings for project-wide defaults such as lazy loading,
placeholder handling, srcset values, breakpoint definitions, ignored file
extensions and the target image file extension.
Available responsive image options
Option
Description
loading
Native image loading hint, for example lazy or eager.
lazyload
Enables JavaScript-style lazy loading using data-src and data-srcset.
placeholder.size
Width of the generated placeholder image.
placeholder.inline
Embeds the placeholder as inline base64 data URI where possible.
srcset
Width or density descriptors used for srcset generation.
sizes
Pattern for the generated sizes attribute.
breakpoints
Breakpoint configuration for picture output.
renderHeightAttribute
Controls whether the fallback image tag should render a height attribute.
ignoreFileExtensions
Comma-separated list of extensions that should not be processed responsively.
fileExtension
Target extension for processed images, for example webp.
class
Default CSS class for rendered image tags.
Default set
The default set renders classic responsive image markup using srcset and
sizes. Its default srcset is:
400, 600, 800, 1000, 1200
Copied!
SVG and GIF files are ignored by default because responsive image processing is
usually not useful for these formats.
Bootstrap set
The Bootstrap set is configured for picture markup. It defines desktop,
tablet and mobile breakpoints and can render WebP output by default.
The extension provides the responsive image configuration as a TypoScript
lib object:
lib.txMediaUtils.responsiveImages
Copied!
This is not a separate global settings API. It is a reusable TypoScript library
that can be copied into the settings of a custom Fluid template, content element
or extension.
The TypoScript setup adds the Media Utils partial path to lib.contentBlock.
Custom content elements can therefore render files with the bundled partial:
Responsive images can use different TYPO3 crop variants for different
breakpoints. This is useful when the same image should be cropped differently
on desktop, tablet and mobile viewports.
The responsive image configuration is passed through
settings.txMediaUtils.responsiveImages. Each entry below breakpoints can
select a TYPO3 crop variant with the cropVariant option.
In this example the generated responsive image output uses:
Breakpoint key
Crop variant
Typical use
0
default
Desktop or default layout.
1
tablet
Tablet-sized layout.
2
mobile
Mobile layout.
The crop variant names must exist in the TCA crop configuration of the used
field. Media Utils does not create the crop variants automatically; it reads the
crop information stored on the FAL reference and applies the variant configured
for the current breakpoint.
If maxWidth or width is passed directly to the partial, that explicit
argument has priority. If no explicit dimension is passed, the partial falls
fall back to dimensions configured in the selected settings group below settings.media.
The responsive image configuration from
settings.txMediaUtils.responsiveImages is applied automatically.
Settings variants
A content element often has more than one visual style, for example a compact
small variant and a full-width big variant. In this case you can group
media-related settings below sub-keys in settings.media and select the desired group
with the settingsVariant argument.
The selected settingsVariant only changes the selected settings group below
settings.media. The responsive image configuration below
settings.txMediaUtils.responsiveImages is still used for breakpoint,
srcset, sizes, lazy-loading and crop-variant handling.
Explicit partial arguments
Values passed directly to the partial have priority over values from the
selected settings variant.
In this case, the explicit maxWidth value is used for the rendered image. If
maxWidth or width is omitted, the partial can use the configured value
from settings.media.small.image.dimensions.
Combining variants and crop variants
You can combine both concepts: use settingsVariant for the semantic style of
the content element and use breakpoints.*.cropVariant for the image crop used
inside the generated responsive image sources.
In this example, hero selects the default dimensions from
settings.media.hero. The final image sources still use the configured crop
variants default, tablet and mobile for the generated breakpoints.
Other usages
Usage in Fluid templates
When using a manually configured FLUIDTEMPLATE, add the partial path and
merge the responsive image settings: