---
title: "Responsive images — Media Library for Laravel | Roundly"
description: "Generate a width ladder and get ready-made srcset and a full <img> tag with an LQIP background."
url: https://roundly-consulting.com/open-source/docs/media-library-for-laravel/responsive-images
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Media Library for Laravel](https://roundly-consulting.com/open-source/docs/media-library-for-laravel.md)

# Responsive images

Opt a bucket into responsive images with ->responsiveWidths(). The package generates one variant per width through the same engine — honouring the sync/queue rules and the variants disk — and never upscales past the original:

```php
$this->addMediaBucket('hero')
    ->useDisk('public')
    ->responsiveWidths([480, 960, 1440, 1920]) // omit for the config default ladder
    ->responsiveFormat('webp');                // optional — defaults to the original's format

$media->srcset();
// "…-480.webp 480w, …-960.webp 960w, …" (ascending, only generated widths)

$media->responsiveImage('', ['alt' => 'Hero', 'sizes' => '100vw', 'class' => 'rounded']);
// full <img> tag with srcset + LQIP blur-up background
```

responsiveImage() emits a full <img> tag with the smallest generated width as the src fallback, the srcset, optional sizes/alt/class, and the LQIP placeholder as an inline blur-up background. media:regenerate rebuilds widths; media:clean removes orphaned width files.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/media-library-for-laravel.md)
