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

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

xtracode/yii2-image
===================

Yii2 image module

13021PHP

Since Aug 15Pushed 7y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Image Module for Yii2
=====================

[](#image-module-for-yii2)

[![License](https://camo.githubusercontent.com/76fd0755b860b40578047ba2494373aaf11ce1daaf761b559c5ce22c4e7aa99b/68747470733a2f2f706f7365722e707567782e6f72672f78747261636f64652f796969322d696d6167652f6c6963656e73652e737667)](https://packagist.org/packages/xtracode/yii2-image)[![Latest Stable Version](https://camo.githubusercontent.com/759d18def1eb01d2e3eed8db90dc0c8a57ca8e544ee5767cd1aca3eb0e807339/68747470733a2f2f706f7365722e707567782e6f72672f78747261636f64652f796969322d696d6167652f762f737461626c652e737667)](https://packagist.org/packages/xtracode/yii2-image)[![Latest Unstable Version](https://camo.githubusercontent.com/2e4aa95130a685cb65818772dab5ee774023dd970a419ad502d50643cadb9d77/68747470733a2f2f706f7365722e707567782e6f72672f78747261636f64652f796969322d696d6167652f762f756e737461626c652e737667)](https://packagist.org/packages/xtracode/yii2-image)[![Total Downloads](https://camo.githubusercontent.com/9d635301138fb8d20509cf820f420c2932543c59a524bdc6e4b7eabb9f19fe09/68747470733a2f2f706f7365722e707567782e6f72672f78747261636f64652f796969322d696d6167652f646f776e6c6f6164732e737667)](https://packagist.org/packages/xtracode/yii2-image)

Yii2 module for image manipulating.

Documentation is at [docs/guide/README.md](docs/guide/README.md).

Features
--------

[](#features)

- image upload
- display image widget
- watermark (text and image)
- image resize on demand

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

[](#installation)

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

Either run

```
php composer.phar require "xtracode/yii2-image" "dev-master"

```

or add

```
"xtracode/yii2-image" : "dev-master"

```

to the require section of your application's `composer.json` file.

Configuration
=============

[](#configuration)

- Add module to config section:

```
'modules' => [
    'image' => [
        'class' => 'xtracode\yii2-image\ImageModule'
    ]
]
```

- Run migrations:

```
php yii migrate --migrationPath=@xtracode/yii2-image/migrations
```

Usage
-----

[](#usage)

- Add actions to your controller:

```
public function actions()
{
    return [
        'delete-image' => [
            'class' => '\xtracode\image\actions\DeleteImageAction',
        ],
        'main-image' => [
            'class' => '\xtracode\image\actions\MainImageAction',
        ],
    ];
}
```

Upload multiple image
---------------------

[](#upload-multiple-image)

Use method **$model-&gt;uploadSingleImage()** in controller:

```
public function actionCreate()
{
    $model = new Article;

    if ($model->load($_POST) && $model->save()) {
        $model->uploadImage();

        \Yii::$app->session->setFlash('success', \Yii::t('article', 'Article successfully saved'));
        return $this->redirect(['view', 'id' => $model->id]);
    } else {
        return $this->render('create', [
            'model' => $model,
        ]);
    }
}
```

In view:

```

```

Upload single image
-------------------

[](#upload-single-image)

use method **$model-&gt;uploadSingleImage()** in controller:

```
public function actionCreate()
{
    $model = new Article;

    if ($model->load($_POST) && $model->save()) {
        $model->uploadSingleImage();

        \Yii::$app->session->setFlash('success', \Yii::t('article', 'Article successfully saved'));
        return $this->redirect(['view', 'id' => $model->id]);
    } else {
        return $this->render('create', [
            'model' => $model,
        ]);
    }
}
```

In view:

```

```

For more details see [the guide](docs/guide/README.md).

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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/12788716?v=4)[Xtra Code](/maintainers/xtracode)[@xtracode](https://github.com/xtracode)

---

Top Contributors

[![xtracode](https://avatars.githubusercontent.com/u/12788716?v=4)](https://github.com/xtracode "xtracode (9 commits)")[![joonail](https://avatars.githubusercontent.com/u/7375538?v=4)](https://github.com/joonail "joonail (3 commits)")

---

Tags

image-manipulationupload-imagesyii2

### Embed Badge

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

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

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

133890.0k3](/packages/goat1000-svggraph)[imagekit/imagekit

PHP library for Imagekit

46877.3k10](/packages/imagekit-imagekit)[gravatarphp/gravatar

Gravatar URL builder which is most commonly called as a Gravatar library

12644.1k2](/packages/gravatarphp-gravatar)

PHPackages © 2026

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