PHPackages                             mmedojevicbg/yii2-smart-image-field - 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. mmedojevicbg/yii2-smart-image-field

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

mmedojevicbg/yii2-smart-image-field
===================================

Image upload field for Yii2 forms

441PHP

Since Feb 12Pushed 10y ago1 watchersCompare

[ Source](https://github.com/mmedojevicbg/yii2-smart-image-field)[ Packagist](https://packagist.org/packages/mmedojevicbg/yii2-smart-image-field)[ RSS](/packages/mmedojevicbg-yii2-smart-image-field/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Smart Image Field - Yii2 extension
==================================

[](#smart-image-field---yii2-extension)

This is replacement of classic file upload HTML form element. Advantages of this field are:

- You don't have to handle file upload yourself. It is encapsulated in ImageUploadAction.
- ImageUploadAction resolves upload name clashes by default.
- If existing model is edited, image field is pre-populated.
- Uploaded image won't be lost if form has validation errors after submit.
- There is a delete image link besides upload button.

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist mmedojevicbg/yii2-smart-image-field "dev-master"

```

or add

```
"mmedojevicbg/yii2-smart-image-field": "dev-master"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

1. Attach ImageUploadAction to designated controller

```
class SiteController extends BaseController
{
    function actions()
    {
        return [
            'upload' => [
                'class' => 'mmedojevicbg\SmartImageField\ImageUploadAction',
                'uploadsPath' => \Yii::getAlias('@webroot') . '/uploads',
                'uploadsUrl' => '/uploads'
            ]
        ];
    }
}
```

2. Utilize SmartImageField inside ActiveForm

```
echo SmartImageField::widget(['model' => $model,
                              'attribute' => 'profile_image',
                              'uploadsHandler' => '/site/upload']);
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

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/1908699?v=4)[Marko Medojevic](/maintainers/mmedojevicbg)[@mmedojevicbg](https://github.com/mmedojevicbg)

---

Top Contributors

[![mmedojevicbg](https://avatars.githubusercontent.com/u/1908699?v=4)](https://github.com/mmedojevicbg "mmedojevicbg (33 commits)")

### Embed Badge

![Health badge](/badges/mmedojevicbg-yii2-smart-image-field/health.svg)

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

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