PHPackages                             wall-e/laravel-imageresize - 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. wall-e/laravel-imageresize

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

wall-e/laravel-imageresize
==========================

A Laravel package to upload and resize images easily with automatic aspect ratio.

1.0.1(8mo ago)17MITPHPPHP &gt;=8.0

Since Sep 5Pushed 8mo agoCompare

[ Source](https://github.com/Rahman-Shaikat/laravel-imageresize)[ Packagist](https://packagist.org/packages/wall-e/laravel-imageresize)[ RSS](/packages/wall-e-laravel-imageresize/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Laravel Image Resize Package
============================

[](#laravel-image-resize-package)

A simple and reusable Laravel package for uploading and resizing images with automatic aspect ratio handling. You can define multiple sizes dynamically (small, thumb, custom), and it supports optional width and height. Perfect for books, sliders, profiles, banners, and any image resizing needs in Laravel.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- Laravel 9.x or 10.x

---

🌐 Features
----------

[](#-features)

- Resize images to multiple sizes in one function call.
- Automatic aspect ratio calculation if height is not provided.
- Supports JPEG, PNG, GIF, and WebP formats.
- Returns all resized image paths for easy database storage.
- Configurable image quality via config/imageresizer.php.
- Works with GdImage objects or uploaded files.
- Can be used in any Laravel application via Composer.

📦 Installation
--------------

[](#-installation)

Require the package via Composer:

```
composer require wall-e/laravel-imageresize
```

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

[](#️-configuration)

If your Laravel version is auto-discoverable, the service provider is loaded automatically. Otherwise, add the provider manually in config/app.php:

```
'providers' => [
    // Other Service Providers
    WallE\LaravelImageresize\ImageResizerServiceProvider::class,
],
```

Publish the config file (optional):

```
php artisan vendor:publish --provider="WallE\LaravelImageresize\ImageResizerServiceProvider" --tag=config
```

This will create config/imageresizer.php:

```
return [
    'quality' => 90, // Default image quality (JPEG/WebP)
];
```

🛠️ Usage
--------

[](#️-usage)

Import the class:

```
use WallE\LaravelImageresize\ImageFunctions;
```

Basic Example:

```
$imagePaths = ImageFunctions::upload(
    $request->file('image_path'), // Uploaded file
    'media/uploads/books', // Storage path
    [
        'small' => ['width' => 158],
        'thumb' => ['width' => 72],
    ]
);
```

Returns an array with resized image paths:

```
[
    'original' => 'media/uploads/book/filename-original.webp',
    'small'    => 'media/uploads/book/filename-small.webp',
    'thumb'    => 'media/uploads/book/filename-thumb.webp',
]
```

Save in database:

```
$book->image_path       = $imagePaths['original'];
$book->image_sm_path    = $imagePaths['small'];
$book->image_thumb_path = $imagePaths['thumb'];
$book->save();
```

Custom Sizes with Optional Height:

```
$imagePaths = ImageFunctions::upload(
    $request->file('image_path'),
    'media/uploads/sliders',
    [
        'large' => ['width' => 1920, 'height' => 600], // exact dimensions
        'medium' => ['width' => 1280],                // height calculated automatically
        'thumb' => ['width' => 320],
    ]
);
```

Using GdImage Objects:

```
$gdImage = imagecreatefromjpeg('example.jpg');

$imagePaths = ImageFunctions::upload(
    $gdImage,
    'media/uploads/custom',
    [
        'small' => ['width' => 200],
        'thumb' => ['width' => 100],
    ]
);
```

Advanced Usage:

You can define any number of sizes dynamically:

```
$sizes = [
    'small'  => ['width' => 150],
    'medium' => ['width' => 300, 'height' => 300],
    'large'  => ['width' => 600],
    'custom' => ['width' => 1024, 'height' => 768],
];

$imagePaths = ImageFunctions::upload($request->file('image_path'), 'uploads/gallery', $sizes);
```

If height is omitted, it is automatically calculated from the original aspect ratio.

Configuration

You can configure default image quality in config/imageresizer.php:

```
return [
    'quality' => 90, // Range 0 - 100
];
```

Supported Formats:

- JPEG (.jpg / .jpeg)
- PNG (.png)
- GIF (.gif)
- WebP (.webp)

All images are converted to WebP by default except GIFs.

Notes:

- Temporary images are created in storage/app/temp-images during processing.
- The package is fully compatible with Laravel’s storage disks. You can modify it to save directly to S3 or other disks.
- Returns array of paths, so you can save multiple sizes to DB.

Example in Controller:

```
public function store(Request $request)
{
    $request->validate(['image_path' => 'required|image']);

    $imagePaths = ImageFunctions::upload(
        $request->file('image_path'),
        'media/uploads/books',
        [
            'small' => ['width' => 158],
            'thumb' => ['width' => 72],
        ]
    );

    $book = Book::create([
        'title'        => $request->title,
        'image_path'     => $imagePaths['original'],
        'image_sm_path'  => $imagePaths['small'],
        'image_thumb_path' => $imagePaths['thumb'],
    ]);

    return response()->json([
        'message' => 'Book created successfully',
        'data'    => $book
    ]);
}
```

📝 Contributing
--------------

[](#-contributing)

Fork the repository and submit pull requests.

Bug reports, feature requests, and improvements are welcome.

Make sure to follow semantic versioning for updates.

📜 License
---------

[](#-license)

MIT License. See the [LICENSE](LICENSE) file for details.

🔗 Links
-------

[](#-links)

Packagist:

GitHub Repository:

✅ This README explains:
-----------------------

[](#-this-readme-explains)

- Installation
- Configuration
- Multiple usage examples
- Handling aspect ratio
- Saving to database

---

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance61

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

Total

2

Last Release

249d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4540d751221c1bc3ef9d030304551837741437b66e06f19b1f9d3ed54d4dde80?d=identicon)[rahman-shaikat](/maintainers/rahman-shaikat)

---

Top Contributors

[![Rahman-Shaikat](https://avatars.githubusercontent.com/u/64092487?v=4)](https://github.com/Rahman-Shaikat "Rahman-Shaikat (6 commits)")

### Embed Badge

![Health badge](/badges/wall-e-laravel-imageresize/health.svg)

```
[![Health](https://phpackages.com/badges/wall-e-laravel-imageresize/health.svg)](https://phpackages.com/packages/wall-e-laravel-imageresize)
```

###  Alternatives

[creativeorange/gravatar

A Laravel Gravatar package for retrieving gravatar image URLs or checking the existance of an image.

5467.5M54](/packages/creativeorange-gravatar)[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M102](/packages/intervention-image-laravel)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[ralphjsmit/laravel-glide

Auto-magically generate responsive images from static image files.

4719.6k5](/packages/ralphjsmit-laravel-glide)[spatie/laravel-og-image

Generate OG images for your Laravel app

305.2k](/packages/spatie-laravel-og-image)[nikkanetiya/laravel-color-palette

Laravel Wrapper for `ksubileau/color-thief-php`. Grabs the dominant color or a representative color palette from an image. Uses PHP and GD or Imagick.

3312.6k](/packages/nikkanetiya-laravel-color-palette)

PHPackages © 2026

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