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

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

yii2mod/yii2-image
==================

Provides methods for the dynamic manipulation of images. Various image formats such as JPEG, PNG, and GIF can be resized, cropped, rotated.

1.0.0(11y ago)2710.4k11Apache-2.0PHPCI failing

Since Feb 11Pushed 6y ago6 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

 [ ![](https://avatars0.githubusercontent.com/u/993323) ](https://github.com/yiisoft)

Yii2 Image Extension
====================

[](#yii2-image-extension)

Provides methods for the dynamic manipulation of images. Various image formats such as JPEG, PNG, and GIF can be resized, cropped, rotated.

[![Latest Stable Version](https://camo.githubusercontent.com/c5e03a9ec7bda52f1a4c24a7c118eff9fb2f9f2067a7133bc686a277f916b4cd/68747470733a2f2f706f7365722e707567782e6f72672f796969326d6f642f796969322d696d6167652f762f737461626c65)](https://packagist.org/packages/yii2mod/yii2-image) [![Total Downloads](https://camo.githubusercontent.com/251a5d388b6361d8739ca86bf2672ea1075ec9d8dae595de8883ea5ce97ff559/68747470733a2f2f706f7365722e707567782e6f72672f796969326d6f642f796969322d696d6167652f646f776e6c6f616473)](https://packagist.org/packages/yii2mod/yii2-image) [![License](https://camo.githubusercontent.com/7c073e92dadd43d736c8b0ef726ea12cf2b47ba40a965145fd60f4e6fee26b90/68747470733a2f2f706f7365722e707567782e6f72672f796969326d6f642f796969322d696d6167652f6c6963656e7365)](https://packagist.org/packages/yii2mod/yii2-image)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist yii2mod/yii2-image "*"

```

or add

```
"yii2mod/yii2-image": "*"

```

to the require section of your composer.json.

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

[](#configuration)

**Component Setup**

To use the Image Component, you need to configure the components array in your application configuration:

```
'components' => [
    'image' => [
        'class' => 'yii2mod\image\ImageComponent',
    ],
],
```

**Attach the behavior to the model**

You need to add the `ImageBehavior` to the your model.

```
public function behaviors()
{
    return [
        'image' => [
            'class' => ImageBehavior::class,
            'pathAttribute' => 'path',
        ],
    ];
}
```

**Action Setup**

You need to add the `ImageAction` to the your controller.

```
public function actions()
{
    return [
        'image' => 'yii2mod\image\actions\ImageAction'
    ];
}
```

**Configuring image types**

Next, you should configure your params section in your configuration file:

```
'params' => [
    'image' => [
        'medium' => [
            'thumbnail' => [
                'box' => [194, 194],
                'mode' => 'outbound'
            ],
            'visible' => 'user', //checking role before outputing url
        ],
        'home' => [
            'thumbnail' => [
                'box' => [640, 480],
                'mode' => 'inset',
            ],
            'watermark' => [
                'watermarkFilename' => '@app/web/images/watermark.png',
            ],
        ],
    ],
],
```

Usage:
------

[](#usage)

```
$model = Model::find()->one();
echo $model->url('medium'); // home is the type of photo.
```

Support us
----------

[](#support-us)

Does your business depend on our contributions? Reach out and support us on [Patreon](https://www.patreon.com/yii2mod). All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 77.8% 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

Unknown

Total

1

Last Release

4109d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a53a15e1548ce60ee92591e71492a39eaaecfc88eaa1a9d7f353d5c910381de?d=identicon)[disem](/maintainers/disem)

---

Top Contributors

[![dmitry-semenov](https://avatars.githubusercontent.com/u/17027799?v=4)](https://github.com/dmitry-semenov "dmitry-semenov (14 commits)")[![pavlm](https://avatars.githubusercontent.com/u/8758854?v=4)](https://github.com/pavlm "pavlm (4 commits)")

---

Tags

yii2yii2-imageyii2extension

### Embed Badge

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

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

###  Alternatives

[trntv/yii2-glide

Yii2 Glide Extension

41269.5k9](/packages/trntv-yii2-glide)[noam148/yii2-image-resize

A Yii2 component for resizing images (on the fly)

1144.6k7](/packages/noam148-yii2-image-resize)[maxmirazh33/yii2-uploadable-cropable-image

Yii2 extension for upload and crop images

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

 yii2 image cropping extension

101.5k](/packages/developit-yii2-jcrop)

PHPackages © 2026

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