PHPackages                             masum-nishat/image-resize-php - 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. masum-nishat/image-resize-php

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

masum-nishat/image-resize-php
=============================

Resize image to desire file size by only one compression

v1.1.0(6y ago)025[1 PRs](https://github.com/MasumNishat/imageResize/pulls)Apache-2.0PHPPHP &gt;=7.2.0

Since Nov 16Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/MasumNishat/imageResize)[ Packagist](https://packagist.org/packages/masum-nishat/image-resize-php)[ RSS](/packages/masum-nishat-image-resize-php/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)DependenciesVersions (6)Used By (0)

image-resize-php
================

[](#image-resize-php)

PHP library to resize image to desire file size by only one compression.

---

Warning
-------

[](#warning)

This is a development package. I encourage not to use in production environment.

Please inform if any bug or security issue or any other problem found.

Any suggestion will be taken seriously.

Setup
-----

[](#setup)

This package is available through Packagist with the vendor and package identifier the same as this repo.

If using [Composer](https://getcomposer.org/), run following command:

```
composer require "masum-nishat/image-resize-php":"^1.1.0"
```

> Note: This library uses GD class which do not support resizing animated gif files

---

Resize
------

[](#resize)

Only supported resizing param is according to file size. Image dimension will be changed and final image will be under 250KB (Default).

```
imageResize::convert('image.jpg', 'image-converted.jpg');
//or
imageResize::convert('image.png', 'image-converted.png');
```

Let the extension detect automatically from mime type:

```
imageResize::convert('image.jpg', 'image-converted');
//or
imageResize::convert('image.png', 'image-converted');
```

Declare required maximum size:

```
imageResize::$targetSize = 300000; //maximum 300KB

imageResize::convert('image.jpg', 'image-converted');
//or
imageResize::convert('image.png', 'image-converted');
```

This class creat unique temp directory and delete it after using. To use custom temp directory and not delete temp components (useful for debugging):

```
imageResize::$tempDir = 'path/to/temp/folder';

imageResize::convert('image.jpg', 'image-converted');
//or
imageResize::convert('image.png', 'image-converted');
```

Supported Image Types
---------------------

[](#supported-image-types)

- `IMAGETYPE_JPEG`
- `IMAGETYPE_PNG`
- `IMAGETYPE_GIF`

Quality
-------

[](#quality)

Maximum quality is selected by default.

Quality change param is not implemented yet;

Exceptions
----------

[](#exceptions)

Exception handling not implemented yet.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance44

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

3

Last Release

2419d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11717288?v=4)[Masum Nishat](/maintainers/MasumNishat)[@MasumNishat](https://github.com/MasumNishat)

---

Top Contributors

[![MasumNishat](https://avatars.githubusercontent.com/u/11717288?v=4)](https://github.com/MasumNishat "MasumNishat (13 commits)")

---

Tags

file-sizeone-compressionresize-image

### Embed Badge

![Health badge](/badges/masum-nishat-image-resize-php/health.svg)

```
[![Health](https://phpackages.com/badges/masum-nishat-image-resize-php/health.svg)](https://phpackages.com/packages/masum-nishat-image-resize-php)
```

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

135911.1k3](/packages/goat1000-svggraph)[gravatarphp/gravatar

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

16653.6k2](/packages/gravatarphp-gravatar)[rsoury/wp-imgix

Rewrites WordPress image URLs to use ImgIX

167.2k](/packages/rsoury-wp-imgix)

PHPackages © 2026

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