PHPackages                             grupobahez/imageoptimizer - 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. grupobahez/imageoptimizer

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

grupobahez/imageoptimizer
=========================

Package for image optimization in Laravel

v1.1.0(1y ago)00MITPHPPHP &gt;=8.2

Since Dec 29Pushed 1y agoCompare

[ Source](https://github.com/grupobahez/imageoptimizer)[ Packagist](https://packagist.org/packages/grupobahez/imageoptimizer)[ RSS](/packages/grupobahez-imageoptimizer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (4)Used By (0)

grupobahez/imageoptimizer
=========================

[](#grupobahezimageoptimizer)

Package for optimizing and generating multiple image sizes in Laravel using [Intervention Image](http://image.intervention.io/).

Installation
------------

[](#installation)

```
composer require grupobahez/imageoptimizer
```

Usage
-----

[](#usage)

1. Publish the configuration file (optional):

    ```
    php artisan vendor:publish --provider="Grupobahez\Imageoptimizer\ImageOptimizerServiceProvider"
    ```
2. Configure the values in `config/imageoptimizer.php`.
3. In your code, use the `ImageOptimizer` facade to optimize images:

    ```
    use Grupobahez\Imageoptimizer\Facades\ImageOptimizer;
    use Grupobahez\Imageoptimizer\Support\ResizeStrategies;

    // ...
    ImageOptimizer::optimize(Storage::disk('public')->path('myimage.jpg'), [
        'disk' => 'public',
        'quality' => 70,
        'format' => 'webp',
        'thumbnails' => [
            'small' => [150, 150],
            'medium' => [300, 300],
            // ...
        ],
        'strategy' => ResizeStrategies::COVER, // fill | crop | fit | cover | cover-top | cover-bottom | cover-left | cover-right
                               // cover-top-left | cover-top-right | cover-bottom-left | cover-bottom-right
        'output_folder' => 'new-folder', // Optional: Specify a custom output folder
        'output_file' => 'custom-name',  // Optional: Specify a custom base filename
    ]);
    ```
4. Optimize images from url

    ```
    use Grupobahez\Imageoptimizer\Facades\ImageOptimizer;
    use Grupobahez\Imageoptimizer\Support\ResizeStrategies;

    // ...
    ImageOptimizer::optimizeFromUrl('https://example.com/image.jpg', [
        'disk' => 'public',
        'quality' => 70,
        'format' => 'webp',
        'thumbnails' => [
            'small' => [150, 150],
            'medium' => [300, 300],
            // ...
        ],
        'strategy' => ResizeStrategies::COVER, // fill | crop | fit | cover
        'output_folder' => 'new-folder', // Optional: Specify a custom output folder
        'output_file' => 'custom-name',  // Optional: Specify a custom base filename
    ]);
    ```

Default Configuration
---------------------

[](#default-configuration)

The package includes a configuration file that you can overwrite by publishing it in your project. The default values are:

```
return [
    'quality' => 80,
    'format' => 'webp',
    'strategy' => 'fit',
    'thumbnails' => [
        'small' => [150, 150],
        'medium' => [300, 300],
        'large' => [1024, 768],
    ],
];
```

Features
--------

[](#features)

- Image quality reduction.
- Conversion between formats (e.g., JPEG to WebP).
- Generation of multiple image sizes (*thumbnails*).
- Specify custom output folder and file names for the optimized images.

Resize Strategies
-----------------

[](#resize-strategies)

[![Estrategias de optimización](/assets/examples.png)](/assets/examples.png)

- **`fit`**: Maintains the aspect ratio; can handle `0` in width or height for proportional resizing.
- **`fill`**: Ensures the image covers the frame entirely, maintains the full image; can handle `0` in width or height.
- **`cover`**: Ensures the image covers the frame entirely, recropping from the center; can handle `0` in width or height.
- **`crop`**: Crops the image to exact dimensions; both width and height must be specified (does not support `0`).
- **`cover-top`**: Ensures the image covers the frame entirely, recropping from the top; can handle `0` in width or height.
- **`cover-bottom`**: Ensures the image covers the frame entirely, recropping from the bottom; can handle `0` in width or height.
- **`cover-left`**: Ensures the image covers the frame entirely, recropping from the left; can handle `0` in width or height.
- **`cover-right`**: Ensures the image covers the frame entirely, recropping from the right; can handle `0` in width or height.
- **`cover-top-left`**: Ensures the image covers the frame entirely, recropping from the top-left; can handle `0` in width or height.
- **`cover-top-right`**: Ensures the image covers the frame entirely, recropping from the top-right; can handle `0` in width or height.
- **`cover-bottom-left`**: Ensures the image covers the frame entirely, recropping from the bottom-left; can handle `0` in width or height.
- **`cover-bottom-right`**: Ensures the image covers the frame entirely, recropping from the bottom-right; can handle `0` in width or height.

Notes on Output Folder and Filename
-----------------------------------

[](#notes-on-output-folder-and-filename)

- You can specify a custom output folder using the `output_folder` option.
- You can define a custom base filename using the `output_file` option.
- If `output_folder` is not provided, the folder of the original image will be used.
- If `output_file` is not provided, the name of the original image will be used as the base.

Testing
-------

[](#testing)

The package includes unit tests with PHPUnit. You can run them using:

```
vendor/bin/phpunit
```

License
-------

[](#license)

This package is licensed under the [MIT License](LICENSE).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance40

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

505d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/29510c3f37e000b922010fb5da3ba26eb8d568d27da0c9e910cbbb612c9e2aba?d=identicon)[ElSeoClub](/maintainers/ElSeoClub)

---

Top Contributors

[![ElSeoClub](https://avatars.githubusercontent.com/u/79345920?v=4)](https://github.com/ElSeoClub "ElSeoClub (7 commits)")

---

Tags

laravelthumbnailimageoptimizer

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/grupobahez-imageoptimizer/health.svg)

```
[![Health](https://phpackages.com/badges/grupobahez-imageoptimizer/health.svg)](https://phpackages.com/packages/grupobahez-imageoptimizer)
```

###  Alternatives

[intervention/image-laravel

Laravel Integration of Intervention Image

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

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[folklore/image

Image manipulation library for Laravel 5 based on Imagine and inspired by Croppa for easy url based manipulation

270248.2k5](/packages/folklore-image)[rolandstarke/laravel-thumbnail

Laravel Thumbnail generator

52140.6k](/packages/rolandstarke-laravel-thumbnail)[thapp/jitimage

Just in time image manipulation.

997.5k1](/packages/thapp-jitimage)

PHPackages © 2026

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