PHPackages                             coercive/imgprocess - 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. coercive/imgprocess

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

coercive/imgprocess
===================

Coercive Utility ImgProcess

0.1.2(1y ago)11.3kMITPHP &gt;=7.4

Since Jun 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Coercive/ImgProcess)[ Packagist](https://packagist.org/packages/coercive/imgprocess)[ Docs](http://coercive.fr)[ RSS](/packages/coercive-imgprocess/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (1)Versions (18)Used By (0)

Coercive ImgProcess
===================

[](#coercive-imgprocess)

- The ImgProcess allows you to easily resize your images in PHP with util options like "cover" which allows to cover a dimensioned area provided just as would do the css property of the same name; Or the "crop" that allows you to crop a specific area of your image.

Get
---

[](#get)

```
composer require coercive/imgprocess

```

Resize image
============

[](#resize-image)

```
use Coercive\Utility\ImgProcess\ImgProcess;

# INIT
$img = new ImgProcess;

# QUALITY (optional : default jpg 60 /  png 0)
$img
	->setJpgQuality(50)
	->setPngCompression(5);

# EXAMPLE SET
$img
	->setOverwriting(true)
	->setInputPath('source/path/image_name.jpg')
	->setOutputPath('output/path/new_image.jpg')
	->setSourceCoordinate('RIGHT', 'BOTTOM')
	->setOutputSize(1000, 1000);

# PROCESS
$bVerif = $img->sameSize();
// or
$bVerif = $img->myOwnSize(500);
// or
$bVerif = $img->crop();
// or
$bVerif = $img->cover();
// ...

# HANDLE ERRORS
if( !$bVerif ) {
	if( $aError = $img->getError() ) {
		foreach ($aError as $sMessage) { echo "$sMessage"; }
		die('Shutdow After Process');
	}
	else {
		die('Shutdow After Process : Unknow Error.');
	}
}
```

Detect image quality
--------------------

[](#detect-image-quality)

```
# DETECT IMAGE QUALITY (base on linux 'identify')
$iQuality = ImgProcess::getImageQuality('/path/image_name.jpg');
```

Get image size
--------------

[](#get-image-size)

```
$sizes = ImgProcess::getImageSize('/path/image_name.jpg');
echo $sizes['width'] . ' x ' . $sizes['height']
```

---

---

Html responsive image
=====================

[](#html-responsive-image)

Example of html content to reformat.

```

    Hello World

```

Instantiate basic options
-------------------------

[](#instantiate-basic-options)

```
use Coercive\Utility\ImgProcess\ImgResponsive;

$rii = (new ImgResponsive)
    ->overwrite(true)
    ->data($data)
    ->path('/rootpath/server/img', '/realpath/img')
```

### Mode SRCSET with multiplier option

[](#mode-srcset-with-multiplier-option)

```
$rii
    ->modeSrcset(true)
    ->size(500, '1x', true)
    ->size(1000, '2x')
    ->size(1500, '3x')
```

### Mode SRCSET with query option

[](#mode-srcset-with-query-option)

```
$rii
    ->modeSrcset()
    ->size(645, '(max-width: 750px) 645px')
    ->size(1095, '(min-width: 751px) and (max-width: 938px) 1095px')
    ->size(862, '(min-width: 939px) and (max-width: 1169px) 832px')
    ->size(1095, '(min-width: 1170px) 1095px', true)
```

### Mode PICTURE with query option

[](#mode-picture-with-query-option)

```
$rii
    ->modePicture()
    ->size(645, '(max-width: 750px) 645px')
    ->size(1095, '(min-width: 751px) and (max-width: 938px) 1095px')
    ->size(862, '(min-width: 939px) and (max-width: 1169px) 832px')
    ->size(1095, '(min-width: 1170px) 1095px', true)
```

### Resolve image src path

[](#resolve-image-src-path)

Here is an example of retrieving the good image path if you have some complex directory tree.

```
$rii->resolve(function ($path) {
    $path = urldecode($path);

    if(!preg_match('`/(?Ptestmode|production)/filedirectory/(?P/.+)$`', $path, $matches)) {
        return '';
    }

    $env = $matches['env'];
    $relpath = $matches['relpath'];
    return  preg_replace('`testmode|production`', $env, '/root/production/specific/path') . $relpath;
});
```

### Start process and get HTML

[](#start-process-and-get-html)

```
try {
    $rii->process();
}
catch (Exception $e) {
    // do something
    echo $e->getMessage();
    exit;
}

$formattedHtml = $rii->getHtml();
if(!$formattedHtml) {
    die('KO');
}

echo $formattedHtml;
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance47

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Recently: every ~147 days

Total

17

Last Release

395d ago

PHP version history (2 changes)0.0.1PHP &gt;=7

0.0.10PHP &gt;=7.4

### Community

Maintainers

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

---

Top Contributors

[![Coercive](https://avatars.githubusercontent.com/u/20288080?v=4)](https://github.com/Coercive "Coercive (21 commits)")

### Embed Badge

![Health badge](/badges/coercive-imgprocess/health.svg)

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

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[char0n/ffmpeg-php

PHP wrapper for FFmpeg application

495225.1k1](/packages/char0n-ffmpeg-php)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)

PHPackages © 2026

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