PHPackages                             michaldoda/laravel-s3-thumbnail - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. michaldoda/laravel-s3-thumbnail

ActiveLibrary[File &amp; Storage](/categories/file-storage)

michaldoda/laravel-s3-thumbnail
===============================

Customizable thumbnail generator for Laravel. From s3 to local disk. Minimize size of your images!

3.0.1(2y ago)044MITPHPPHP ^8.1

Since Jan 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/michaldoda/laravel-s3-thumbnail)[ Packagist](https://packagist.org/packages/michaldoda/laravel-s3-thumbnail)[ Docs](https://github.com/michaldoda/laravel-s3-thumbnail)[ RSS](/packages/michaldoda-laravel-s3-thumbnail/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (10)Used By (0)

Laravel S3 Thumbnail
--------------------

[](#laravel-s3-thumbnail)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ccf6ab11b3a830bc3861ef11270d58d206726e5a7b98b13224e6b9e22b3346fe/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f6d696368616c646f64612f6c61726176656c2d73332d7468756d626e61696c)](https://camo.githubusercontent.com/ccf6ab11b3a830bc3861ef11270d58d206726e5a7b98b13224e6b9e22b3346fe/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f6d696368616c646f64612f6c61726176656c2d73332d7468756d626e61696c)[![Total Download](https://camo.githubusercontent.com/aee539877817928fcac074d109062957a5607bbe95d560e4a795abcc73844cb0/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f64742f6d696368616c646f64612f6c61726176656c2d73332d7468756d626e61696c)](https://camo.githubusercontent.com/aee539877817928fcac074d109062957a5607bbe95d560e4a795abcc73844cb0/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f64742f6d696368616c646f64612f6c61726176656c2d73332d7468756d626e61696c)[![License](https://camo.githubusercontent.com/73e844c91dc8746e2b1d294e494a9341f8bfc3c6d93714fc1ba51dbb41edc72e/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f6c6963656e73652f6d696368616c646f64612f6c61726176656c2d73332d7468756d626e61696c)](https://camo.githubusercontent.com/73e844c91dc8746e2b1d294e494a9341f8bfc3c6d93714fc1ba51dbb41edc72e/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f6c6963656e73652f6d696368616c646f64612f6c61726176656c2d73332d7468756d626e61696c)

[![This is an image](docs/example.png)](docs/example.png)

🔥 **original photo was 1024x1024, 989.98 kB**

By creating many media pages, I have worked out some solution. This package will help you to minimize S3 / Cloudfront costs (sometimes unexpected) and the amount of data transfer. It also helps SEO by optimizing the image size - yeah I tried that and Google Lighthouse likes that. 🎉

If your assets are not in terabytes, this package may be of help to you. Especially if you create small or medium-sized media sites.

You can configure your own thumbnails settings. Currently, the package supports resize, crop and quality. It is not much, but it is a good step for optimizing your website.

### Installation

[](#installation)

```
# Install package
composer require michaldoda/laravel-s3-thumbnail

# Publish configuration
php artisan vendor:publish --tag=s3-thumbnail-config

# (Optional) if storage has not been linked
php artisan storage:link
```

### Usage

[](#usage)

```
# resources/article/some-view.blade.php
{{ $article->yourImageModel->getThumbnailHtml('article_main') }}

# it will produce

```

```
# app/Models/YourImageModel.php
use MichalDoda\LaravelS3Thumbnail\ThumbnailInterface;
use MichalDoda\LaravelS3Thumbnail\ThumbnailTrait;

class YourImageModel extends Model implements ThumbnailInterface
{
    use ThumbnailTrait;

    public function getS3ImagePath(): string
    {
        return $this->path;
    }

    public function getImageAltDescription(): ?string
    {
        return $this->alt;
    }
}
```

```
# config/s3-thumbnail.php
'thumbnails' => [
   'article_main' => [
        [
            'max_width' => 'default',
            'quality' => 50,
            'filters' => [
                'resize' => [
                    'width'  => 550,
                ],
            ],
        ],
        [
            'max_width' => 600,
            'quality' => 50,
            'filters' => [
                'resize' => [
                    'width'  => 350,
                ],
            ],
        ],
        // ...
    ],
]
```

### Configuration

[](#configuration)

```
/**
 * It is a default Laravel local disk name.
 * If you are using different disk for local purpose then please update the value.
 */
'local_disk' => 'local',
/**
 * It is a default Laravel s3 disk name.
 * If you are using different disk for s3 file system then please update the value.
 */
's3_disk' => 's3',
/**
 * It is a default Laravel public disk name.
 * If you are using different disk for public purpose then please update the value.
 */
'public_disk' => 'public',
/**
 * It will create directory ./storage/app/public/thumbnails.
 * There will be placed all thumbnails generated by the package.
 * If you already use one of the path below then please update the value.
 * ./storage/app/public/thumbnails
 * ./public/storage/thumbnails
 */
'public_path' => 'thumbnails',
/**
 * It will create directory ./storage/app/originals.
 * There will be placed all images retrieved from AWS S3 disk.
 * If you already use path ./storage/app/originals then please update the value.
 */
'originals_path' => 'originals',
/**
 * Default format for thumbnails.
 * Available options: webp, jpeg
 */
'default_format' => 'webp',
/**
 * Default quality for thumbnails.
 * It will be used only if single thumbnail configuration does not have own value.
 */
'default_quality' => 80,
/**
 * Thumbnails configuration.
 */
'thumbnails' => [
    /**
     * Reduce image quality to 70% for all screens
     */
    'article_main' => [
        [
            'max_width' => 'default',
            'quality' => 70,
            'filters' => [],
        ]
    ],
    /**
     * Reduce image quality to 70% for screens viewport > 480px
     * Reduce image quality to 50% for screens viewport  [
        [
            'max_width' => 'default',
            'quality' => 70,
            'filters' => [],
        ],
        [
            'max_width' => 480,
            'quality' => 50,
            'filters' => [],
        ],
    ],
    /**
     * Reduce image quality to 70% for all screens
     * Resize to width 550px
     */
    'article_suggestions1' => [
        [
            'max_width' => 'default',
            'quality' => 70,
            'filters' => [
                'resize' => [
                    'width'  => 550,
                ],
            ],
        ],
    ],
    /**
     * Reduce image quality to 70% for all screens
     * Resize to width 650
     * Crop 550x400
     */
    'article_suggestions2' => [
        [
            'max_width' => 'default',
            'quality' => 70,
            'filters' => [
                'resize' => [
                    'width'  => 650,
                ],
                'crop' => [
                    'width' => 550,
                    'height' => 400,
                ],
            ],
        ],
    ],
]
```

### Testing

[](#testing)

```
composer test
```

### License

[](#license)

This package is open-sourced software licensed under the [MIT License](LICENSE).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~72 days

Recently: every ~123 days

Total

9

Last Release

1005d ago

Major Versions

1.3.0 → 2.0.02022-04-05

2.1.1 → 3.0.02023-08-11

PHP version history (3 changes)1.0.0PHP ^7.4|^8.0

2.0.0PHP ^8.0

3.0.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3050636?v=4)[Michael](/maintainers/michaldoda)[@michaldoda](https://github.com/michaldoda)

---

Top Contributors

[![michaldoda](https://avatars.githubusercontent.com/u/3050636?v=4)](https://github.com/michaldoda "michaldoda (23 commits)")

---

Tags

laravels3thumbnaillaravelthumbnails3s3 thumbnails

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/michaldoda-laravel-s3-thumbnail/health.svg)

```
[![Health](https://phpackages.com/badges/michaldoda-laravel-s3-thumbnail/health.svg)](https://phpackages.com/packages/michaldoda-laravel-s3-thumbnail)
```

###  Alternatives

[aws/aws-sdk-php-laravel

A simple Laravel 9/10/11/12/13 service provider for including the AWS SDK for PHP.

1.7k35.6M75](/packages/aws-aws-sdk-php-laravel)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
