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

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

anmishael/yii2-image
====================

Yii2 extension for image manipulating using Kohana Image Library.

023PHP

Since Aug 4Pushed 10y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

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)

```
{
	"require":
	{
  		"anmishael/yii2-image": "dev-master"
	}
}

```

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');
```

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

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

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://avatars.githubusercontent.com/u/9609936?v=4)[anmishael](/maintainers/anmishael)[@anmishael](https://github.com/anmishael)

---

Top Contributors

[![anmishael](https://avatars.githubusercontent.com/u/9609936?v=4)](https://github.com/anmishael "anmishael (2 commits)")

### Embed Badge

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

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

###  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)
