PHPackages                             vladimir-alekseev-go/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. [Image &amp; Media](/categories/media)
4. /
5. vladimir-alekseev-go/yii2-image-processor

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

vladimir-alekseev-go/yii2-image-processor
=========================================

Configurable image processing for Yii2.

v1.1.2(5y ago)0777MITPHPCI failing

Since Jun 24Pushed 5y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (3)Versions (5)Used By (0)

yii2-imageprocessor
===================

[](#yii2-imageprocessor)

Application component for [Yii2](https://github.com/yiisoft/yii2). Its main use case is to process images with a chain of *preconfigured* transformations. A simple DSL inspired by [WideImage's smart coordinates](http://wideimage.sourceforge.net/documentation/smart-coordinates) is used to add some flexibility to the configuration. WideImage library itself isn't used, all actual image processing is delegated to [Imagine](https://github.com/avalanche123/Imagine).

Ad-hoc processing is also supported but if heavy and complex image manipulation is a key feature of your application it's probably better to use Imagine directly.

Getting started
---------------

[](#getting-started)

Install via Composer:

```
    "require": {
        "vladimir-alekseev-go/yii2-image-processor": "*"
    }
```

Configure it in the 'components' section of your application configuration:

```
'imageProcessor' => [
  'class' => '\phtamas\yii2\imageprocessor\Component',
  // Default for all JPEG images
  'jpegQuality' => 90,
  // Default for all PNG images
  'pngCompression' => 7,

  // Create named image categories with their own configuration.
  // You can refer them by name in application code.
  'define' => [

    'userAvatar' => [
      // Add transformations. They will be applied in the order they were defined.
      'process' => [
        // Fix images with embedded orientation metadata
        ['autorotate'],
        // Preapre image to crop by resizing it to cover a 160*160 square
        ['resize', 'width' => 160, 'height' => 160, 'scaleTo' => 'cover'],
        // Crop it
        ['crop', 'x' => 'center - 80', 'y' => 'center - 80', 'width' => 160, 'height' => 160],
      ],
    ],

    'galleryImage' => [
       // Override default to save some disk space and bandwidth
      'jpegQuality' => 80,
      'process' => [
        // Resize proportionally to fit a 600*600 square but only if too large
        ['resize', 'width' => 600, 'height' => 600, 'scaleTo' => 'fit', 'only' => 'down'],
        // Mark your property
        ['watermark', 'path' => '@path/to/wmark.png', 'align' => 'top-left', 'margin' => 20],
      ],
    ],

  ],
],
```

And use it anywhere in your application:

```
// Process uploaded image and save as a JPEG file
$path = '@image/user/avatar/' . uniqid() . '.jpg';
Yii::$app->imageProcessor->save(['file' => $uploadedFile->tempName], $path, 'userAvatar');

// Process image (stored as BLOB in the DB) and send it to the HTTP client
Yii::$app->imageProcessor->send(['data' => 'binary string'], 'jpg', 'galleryImage');

// Ad-hoc processing is possible, too
Yii::$app->imageProcessor->saveAndSend(['file' => '@images/image.jpg'], $path, 'jpg', [
    'process' => [['resize', 'width' => 300]], // Resize proportionally to 300 px width
]);
```

Learn more
----------

[](#learn-more)

- [Component API](doc/component-api.md)
- [Transformations](doc/transformations.md)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

4

Last Release

2149d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f0ad5cb01ae1d81d95fce5959defa8d98bc18200e7e96783eb365c28c40b225f?d=identicon)[vladimir.alekseev](/maintainers/vladimir.alekseev)

---

Top Contributors

[![vladimir-alekseev-go](https://avatars.githubusercontent.com/u/45426838?v=4)](https://github.com/vladimir-alekseev-go "vladimir-alekseev-go (6 commits)")

---

Tags

image manipulationimage processingyii2image transformation

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[imagine/imagine

Image processing for PHP

4.5k72.4M341](/packages/imagine-imagine)[rokka/imagine-vips

libvips adapter for imagine

43564.1k5](/packages/rokka-imagine-vips)[pixelandtonic/imagine

Image processing for PHP

133.4M3](/packages/pixelandtonic-imagine)[ace-of-aces/laravel-image-transform-url

Easy, URL-based image transformations inspired by Cloudflare Images.

1756.4k](/packages/ace-of-aces-laravel-image-transform-url)[batdan/midjourney-api-php

Generate images Midjourney (Discord API). URLs in prompt accepted

222.2k](/packages/batdan-midjourney-api-php)[maxmirazh33/yii2-uploadable-cropable-image

Yii2 extension for upload and crop images

1020.8k](/packages/maxmirazh33-yii2-uploadable-cropable-image)

PHPackages © 2026

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