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

ActiveYii2-extension[Image &amp; Media](/categories/media)

yurkinx/yii2-image
==================

Yii2 extension for image manipulating using Kohana Image Library.

v1.3(7y ago)66428.8k—7.4%36[2 issues](https://github.com/yurkinx/yii2-image/issues)[3 PRs](https://github.com/yurkinx/yii2-image/pulls)9BSD-3-ClausePHPPHP &gt;=5.4.0

Since Apr 5Pushed 2y ago17 watchersCompare

[ Source](https://github.com/yurkinx/yii2-image)[ Packagist](https://packagist.org/packages/yurkinx/yii2-image)[ Docs](https://github.com/yurkinx/yii2-image)[ RSS](/packages/yurkinx-yii2-image/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (1)Versions (5)Used By (9)

yii2-image
==========

[](#yii2-image)

Simple to use Yii2 Framework extension for image manipulating using powerful Kohana Image Library. Inspired by old yii extension  and Kohana Image Library

Installation
------------

[](#installation)

**Install as a [composer package](https://packagist.org/packages/yurkinx/yii2-image)**

> Use this method to get continuous updates.

```
composer require yurkinx/yii2-image

```

or include the dependency in the `composer.json` file:

```
{
    "require": {
        "yurkinx/yii2-image": "^1.2"

    }
}
```

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

[](#configuration)

In config file

```
/config/web.php

```

Add image component

```
'components' => array(
        ...
        'image' => array(
        	 	'class' => 'yii\image\ImageDriver',
        		'driver' => 'GD',  //GD or Imagick
        		),
		    )

```

Usage
-----

[](#usage)

```
$file=Yii::getAlias('@app/pass/to/file');
$image=Yii::$app->image->load($file);
header("Content-Type: image/png");
echo 	$image->resize($width,$height)->rotate(30)->render();
```

Supported methods out of the box from Kohana Image Library:

```
$image->resize($width = NULL, $height = NULL, $master = NULL);
$image->crop($width, $height, $offset_x = NULL, $offset_y = NULL);
$image->sharpen($amount);
$image->rotate($degrees);
$image->save($file = NULL, $quality = 100);
$image->render($type = NULL, $quality = 100);
$image->reflection($height = NULL, $opacity = 100, $fade_in = FALSE);
$image->flip($direction);
$image->background($color, $opacity = 100);
$image->watermark(Image $watermark, $offset_x = NULL, $offset_y = NULL, $opacity = 100);
```

**Using resize with resize constrains**

```
$image->resize($width, $height, \yii\image\drivers\Image::HEIGHT);
$image->resize($width, $height, \yii\image\drivers\Image::ADAPT)->background('#fff');
```

**Using resize with resize constrains and best quality output image \[for Imagick driver only\]**

Use 1 for best speed and lower quality, 100 for best quality and lower speed. Only values 1,100 currently supported

```
$image->resize($width, NULL, \yii\image\drivers\Image::WIDTH, 100);
```

Possible resize constrains:

```
// Resizing constraints ($master)
    const NONE    = 0x01;
    const WIDTH   = 0x02;
    const HEIGHT  = 0x03;
    const AUTO    = 0x04;
    const INVERSE = 0x05;
    const PRECISE = 0x06;
    const ADAPT   = 0x07;
    const CROP    = 0x08;
```

**Using flip with flipping directions**

```
// Flipping directions ($direction)
$image->flip(\yii\image\drivers\Image::HORIZONTAL);
```

Possible flipping directions:

```
     const HORIZONTAL = 0x11;
     const VERTICAL   = 0x12;
```

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity51

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 60% 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 ~463 days

Total

4

Last Release

2717d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b0e315b96bdf9d4683885cf79656a05500b850d4905a8552a011d7303c0bb50?d=identicon)[yurkinx](/maintainers/yurkinx)

---

Top Contributors

[![yurkinx](https://avatars.githubusercontent.com/u/1325711?v=4)](https://github.com/yurkinx "yurkinx (18 commits)")[![mervick](https://avatars.githubusercontent.com/u/2429298?v=4)](https://github.com/mervick "mervick (7 commits)")[![Pfarrer](https://avatars.githubusercontent.com/u/3874162?v=4)](https://github.com/Pfarrer "Pfarrer (3 commits)")[![coderfly](https://avatars.githubusercontent.com/u/160787?v=4)](https://github.com/coderfly "coderfly (1 commits)")[![fschindler](https://avatars.githubusercontent.com/u/5937990?v=4)](https://github.com/fschindler "fschindler (1 commits)")

---

Tags

imageyii2extension

### Embed Badge

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

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

###  Alternatives

[raoul2000/yii2-jcrop-widget

This extension is a wrapper for the jQuery Image Cropping Plugin (jcrop)

11270.3k2](/packages/raoul2000-yii2-jcrop-widget)[noam148/yii2-image-resize

A Yii2 component for resizing images (on the fly)

1045.1k7](/packages/noam148-yii2-image-resize)

PHPackages © 2026

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