PHPackages                             titi23/image-optimizer-and-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. titi23/image-optimizer-and-resizer

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

titi23/image-optimizer-and-resizer
==================================

Optimize And Resize Images in server

02[1 issues](https://github.com/petritlame/image-optimizer-and-resizer/issues)PHP

Since Jun 21Pushed 7y agoCompare

[ Source](https://github.com/petritlame/image-optimizer-and-resizer)[ Packagist](https://packagist.org/packages/titi23/image-optimizer-and-resizer)[ RSS](/packages/titi23-image-optimizer-and-resizer/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Optimize and Resize images with Laravel in a few lines of code
==============================================================

[](#optimize-and-resize-images-with-laravel-in-a-few-lines-of-code)

This package can compress .png, .jpeg and .gif files. Here's how you can use it:

Compress Image, you can optimize the uploaded image or you can save both of them

```
use titi23\ImageOptimizer\ImageOptimize;

$optimizedImage = new ImageOptimize();

$optimizedImage->ImageOptimized($pathToImage, $saveOriginal);
```

Resize Image without losing the `AspectRatio` of the original Image

```
use titi23\ImageOptimizer\ImageOptimize;

$optimizedImage = new ImageOptimize();

$optimizedImage->ResizeAspectRatio($pathToImage, $percent, $saveOriginal);
```

Resize Image with new width but not losing AspectRatio of the original image (without stretching the new image)

```
use titi23\ImageOptimizer\ImageOptimize;

$optimizedImage = new ImageOptimize();

$optimizedImage->ResizeWidth($pathToImage, $newWidth, $saveOriginal);
```

### Installation

[](#installation)

You can install the package via composer:

```
composer require titi23/image-optimizer-and-resizer
```

Copy and Paste the Service Provider in config/app.php

```
'providers' => [
 ...
 ...
 titi23\ImageOptimizer\ImageOptimizerServiceProvider::class
 ...
]
```

After that, publish the package by running this in your terminal

```
 php artisan vendor:publish --tag=image-optimizer --force
```

### Configuration

[](#configuration)

In the config directory of your project it must be generated a file called `image-optimizer.php`

Description for each attribute:

- `upload_dir` write the name of the directory where you will upload your images e.g. 'uploads/' -ps: the folder must be inside `public`.
- `supportedFormat` array of the types of images that are allowed.
- `compressRate` amount of the compression that image passes through, value between 1 and 100, 1: low quality, 100: high quality
- `resize_percent` percent of the resize of the image, value between 1 and 100, e.g. 50, half of the original version

Credits
-------

[](#credits)

- [Petrit Lame](https://github.com/petritlame/)

License
-------

[](#license)

The MIT License (MIT)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 62.5% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11671448?v=4)[titi23](/maintainers/titi23)[@Titi23](https://github.com/Titi23)

---

Top Contributors

[![petrit-lame](https://avatars.githubusercontent.com/u/32936245?v=4)](https://github.com/petrit-lame "petrit-lame (5 commits)")[![petritlame](https://avatars.githubusercontent.com/u/48964432?v=4)](https://github.com/petritlame "petritlame (3 commits)")

### Embed Badge

![Health badge](/badges/titi23-image-optimizer-and-resizer/health.svg)

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

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

133890.0k3](/packages/goat1000-svggraph)[imagekit/imagekit

PHP library for Imagekit

46877.3k10](/packages/imagekit-imagekit)[gravatarphp/gravatar

Gravatar URL builder which is most commonly called as a Gravatar library

12644.1k2](/packages/gravatarphp-gravatar)

PHPackages © 2026

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