PHPackages                             ab01faz101/laravel-image-resizer - 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. [Image &amp; Media](/categories/media)
4. /
5. ab01faz101/laravel-image-resizer

ActiveLibrary[Image &amp; Media](/categories/media)

ab01faz101/laravel-image-resizer
================================

Resize image to multiple sizes in Laravel

v3.0.3(2mo ago)2421MITPHPPHP &gt;=8.0CI failing

Since Sep 16Pushed 2mo agoCompare

[ Source](https://github.com/Ab01faz101/laravel-image-resizer)[ Packagist](https://packagist.org/packages/ab01faz101/laravel-image-resizer)[ RSS](/packages/ab01faz101-laravel-image-resizer/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (4)Versions (9)Used By (0)

\#📦 Laravel Image Resizer
=========================

[](#-laravel-image-resizer)

[![Packagist Version](https://camo.githubusercontent.com/37c09d5f5246060080bf833babce778348a6c5e5edbbf04085069a4da3076ec0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6162303166617a3130312f6c61726176656c2d696d6167652d726573697a6572)](https://camo.githubusercontent.com/37c09d5f5246060080bf833babce778348a6c5e5edbbf04085069a4da3076ec0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6162303166617a3130312f6c61726176656c2d696d6167652d726573697a6572)[![Downloads](https://camo.githubusercontent.com/ef9f73c0aa5b9a6e0f540e330820438fe92c9d86c16f1715120a67c0e3555a56/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6162303166617a3130312f6c61726176656c2d696d6167652d726573697a6572)](https://camo.githubusercontent.com/ef9f73c0aa5b9a6e0f540e330820438fe92c9d86c16f1715120a67c0e3555a56/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6162303166617a3130312f6c61726176656c2d696d6167652d726573697a6572)[![License](https://camo.githubusercontent.com/255509fb4e7dccf809dac6a3d9d14a529cc7d16bc191f70443824fe612f6a760/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4162303166617a3130312f6c61726176656c2d696d6167652d726573697a6572)](https://camo.githubusercontent.com/255509fb4e7dccf809dac6a3d9d14a529cc7d16bc191f70443824fe612f6a760/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4162303166617a3130312f6c61726176656c2d696d6167652d726573697a6572)

A simple and flexible Laravel package for resizing and encoding images into multiple sizes and formats, powered by [Intervention Image](http://image.intervention.io/).

---

✨ Features
----------

[](#-features)

- Resize images into multiple predefined sizes (XL, MD, SM, XS) or custom sizes.
- Supports image encoding formats: `jpeg`, `jpg`, `png`, and `webp`.
- Saves resized images to specified storage disk and directory.
- Option to override encoder format dynamically.
- Uses Laravel's filesystem and Intervention Image package under the hood.

---

🚀 Installation
--------------

[](#-installation)

1. Require the package via Composer (assuming it’s published on Packagist):

    ```
    composer require ab01faz101/laravel-image-resizer
    ```
2. (Optional) Publish the config file:

    ```
    php artisan vendor:publish --tag=laravel_image_resizer_config
    ```
3. Configure `config/laravel_image_resizer.php` as needed (see Configuration section).

---

⚙️ Configuration
----------------

[](#️-configuration)

The package configuration file contains:

```
return [
    'sizes' => [
        'lg' => [1200, 800],
        'md' => [600, 400],
        'sm' => [150, 150],
    ],
    'config' => [
        'encoder_status' => true,
        'encoder' => 'webp', // supported values: 'webp', 'png', 'jpeg', 'jpg'
    ],
];

```

- `sizes`: Default sizes for resizing.
- `encoder_status`: Enable or disable image encoding.
- `encoder`: Default encoder format for output images.

---

📚 Usage
-------

[](#-usage)

Include the `LaravelImageResizer` trait in your Laravel class:

```
use Ab01faz101\LaravelImageResizer\Traits\LaravelImageResizer;

class YourClass
{
    use LaravelImageResizer;

    // Your methods
}

```

### 🖼️ Basic resize and save

[](#️-basic-resize-and-save)

```
use Illuminate\Http\Request;

public function uploadImage(Request $request)
{
    $image = $request->file('image');

    $paths = $this->resizeAndSave(
        $image,
        'uploads/images', // target directory
        'public',         // storage disk
        'webp'            // optional encoder override
    );

    // $paths will be an array with keys: xl, md, sm, xs containing saved paths.
}

```

### 🔧 Resize with custom sizes

[](#-resize-with-custom-sizes)

```
$sizes = [
    'large' => [1200, 800],
    'medium' => [600, 400],
    'small' => [300, 200],
];

$paths = $this->resizeWithCustomSizes(
    $image,
    $sizes,
    'uploads/custom',
    'public',
    'png'
);

```

---

📋 Methods
---------

[](#-methods)

Method

Description

Parameters

Returns

`resizeAndSave`

Resize the uploaded image into default sizes and save

`UploadedFile $image`, `string $directory`, `string $disk`, `?string $overrideEncoder`

Array of saved file paths

`resizeWithCustomSizes`

Resize the image to custom sizes and save

`UploadedFile $image`, `array $sizes`, `string $directory`, `string $disk`, `?string $overrideEncoder`

Array of saved file paths

---

🛠️ Requirements
---------------

[](#️-requirements)

- PHP 8.2 or higher
- Laravel 10 or higher
- Intervention Image package (`intervention/image`)

---

📄 License
---------

[](#-license)

MIT License

---

👨‍💻 Author
----------

[](#‍-author)

Abolfazl Qaederahmat

---

⭐ If you find this package useful, please star the repository on [GitHub](https://github.com/abolfazlqaederahmat/laravel-image-resizer) ⭐

© 2025 Abolfazl Qaederahmat

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance86

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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 ~31 days

Total

8

Last Release

73d ago

Major Versions

v1.2.9 → v3.0.12026-04-23

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/100883198?v=4)[Abolfazl ghaedrahmat](/maintainers/Ab01faz101)[@Ab01faz101](https://github.com/Ab01faz101)

---

Top Contributors

[![Ab01faz101](https://avatars.githubusercontent.com/u/100883198?v=4)](https://github.com/Ab01faz101 "Ab01faz101 (20 commits)")

---

Tags

imageimage-resizerlaravellivewirephplaravelimagelivewireimage resizeimage sizelaravel image resize

### Embed Badge

![Health badge](/badges/ab01faz101-laravel-image-resizer/health.svg)

```
[![Health](https://phpackages.com/badges/ab01faz101-laravel-image-resizer/health.svg)](https://phpackages.com/packages/ab01faz101-laravel-image-resizer)
```

###  Alternatives

[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[ercogx/laravel-filament-starter-kit

This is a Filament v5 Starter Kit for Laravel 13, designed to accelerate the development of Filament-powered applications.

461.7k](/packages/ercogx-laravel-filament-starter-kit)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)[ayvazyan10/nova-imagic

Imagic is a Laravel Nova field package that allows for image manipulation capabilities, such as cropping, resizing, quality adjustment, and WebP conversion. It utilizes the powerful Intervention Image class for image manipulation.

144.5k1](/packages/ayvazyan10-nova-imagic)

PHPackages © 2026

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