PHPackages                             maxlapko/yii2-image-processor - 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. maxlapko/yii2-image-processor

ActiveYii2-extension

maxlapko/yii2-image-processor
=============================

yii2 image processor

02.9k3PHP

Since Apr 29Pushed 10y ago1 watchersCompare

[ Source](https://github.com/maxlapko/yii2-image-processor)[ Packagist](https://packagist.org/packages/maxlapko/yii2-image-processor)[ RSS](/packages/maxlapko-yii2-image-processor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Image processor 2
=================

[](#image-processor-2)

(Yii2 lib for image manipulation and caching them)

Install
-------

[](#install)

### Composer install

[](#composer-install)

add package to require section

```
require: "maxlapko/yii2-image-processor": "dev-master"

```

run commanf `composer update`

Configuration
-------------

[](#configuration)

```
'components' => array(
    'image' => [
        'class'        => '\maxlapko\components\ImageProcessor',
        'imagePath'    => '@webroot/files/img', //save images to this path
        'imageUrl'     => '@web/files/img',
        'fileMode'     => 0777,
        'imageHandler' => [
            'class' => '\maxlapko\components\handler\ImageHandler',
            'driver' => '\maxlapko\components\handler\drivers\ImageMagic', // \maxlapko\components\handler\drivers\GD
        ],
        'forceProcess' => true, // process image when we call getImageUrl
        'afterUploadProcess' => [
            'condition' => ['maxWidth' => 1280, 'maxHeight' => 1280], // optional
            'actions'   => [
                'resize' => ['width' => 1280, 'height' => 1280]
            ]
        ],
        'presets' => [
            'image_preview' => ['thumb' => ['width'  => 100, 'height' => 100]],
            'image_media_preview' => ['adaptiveThumb' => ['width'  => 175, 'height' => 175]],
        ],
    ]
),
```

ImageBehavior
-------------

[](#imagebehavior)

Behavior for managing image

Model

```
public function behaviors()
{
    return [
        'mImage' => ['class' => '\maxlapko\components\ImageBehavior'],
    ];
}

echo $model->getImagePath('image', 'preset'); // preset = orig it is original file
echo $model->getImageUrl('image', 'preset', true);
$model->uploadImage(UploadedFile::getInstance($model, 'image'), 'image');
$model->deleteImage('image'); or $model->deleteImage('image', 'preset');

public function actionCreate()
{
    $model = new Image;

    if (isset($_POST['Image'])) {
        $model->attributes = $_POST['Image'];
        if ($model->validate()) {
            $model->uploadImage(UploadedFile::getInstance($model, 'image'), 'image');
            $model->save(false);
            $this->redirect(array('view', 'id' => $model->id));
        }
    }

    return $this->render('create', ['model' => $model]);
}
```

ImageValidator
--------------

[](#imagevalidator)

```
public function rules()
{
    return [
        [
            'file', '\maxlapko\components\ImageValidator',
            'extensions' => ['jpg', 'png', 'jpeg', 'gif'], 'maxSize' => 5 * 1024 * 1024, 'minWidth' => 1024, 'minHeight' => 2000
        ],
        // ....
    ];
}
```

ImageHandler supports two drivers: GD, ImageMagick

```
'components' => array(
    'imageHandler' => array(
        'class'  => '\maxlapko\components\handler\ImageHandler',
        'driver' => '\maxlapko\components\handler\drivers\ImageMagic', // DriverGD
        'driverOptions' => [],
    ),
),

Yii::$app->imageHandler->load($file)->resize(100, 100)->show();
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/667c7a719be361641acfb40a5bc0ee36597e97317a887d6b51a27b97eea0f1da?d=identicon)[maxlapko](/maintainers/maxlapko)

---

Top Contributors

[![maxlapko](https://avatars.githubusercontent.com/u/495263?v=4)](https://github.com/maxlapko "maxlapko (8 commits)")

### Embed Badge

![Health badge](/badges/maxlapko-yii2-image-processor/health.svg)

```
[![Health](https://phpackages.com/badges/maxlapko-yii2-image-processor/health.svg)](https://phpackages.com/packages/maxlapko-yii2-image-processor)
```

PHPackages © 2026

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