PHPackages                             artkost/yii2-image-style-behavior - 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. artkost/yii2-image-style-behavior

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

artkost/yii2-image-style-behavior
=================================

Yii 2 image styles generation behavior

0.1(11y ago)3451BSD-3-ClausePHP

Since Mar 8Pushed 10y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (3)Used By (0)

Image style generate behavior for Yii 2
=======================================

[](#image-style-generate-behavior-for-yii-2)

Create sets of styles for your images

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

[](#installation)

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

Either run

```
$ composer require artkost/yii2-image-style-behavior
```

or add

```
"artkost/yii2-image-style-behavior": "*"

```

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

Configuring
-----------

[](#configuring)

Configure model as follows

```
use artkost\imagestyle\ImageStyleBehavior;

class ImageFile extends \yii\db\ActiveRecord
{
    public function behaviors()
    {
        return [
            'styles' => [
                'class' => ImageStyleBehavior::className(),
                'path' => '@webroot/uploads/styles',
                'url' => '@web/uploads/styles',
                'attribute' => 'uri',
                'styles' => [
                    'big' => [$this, 'styleBig'], //can be any valid callable
                    'small' => [$this, 'styleSmall']
                ]
            ]
        ];
    }

    /**
     * @return \Imagine\Image\ManipulatorInterface
     */
    public function styleBig()
    {
        return Image::thumbnail($this->filePath, 814, 458)->save($this->style('big')->path);
    }
}
```

Usage
-----

[](#usage)

```
$file = ImageFile::findOne($id);
echo $file->style('big')->url;
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4084d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/441cca4d09df63db37a2aaa99f6481d67b62f0cb208031f3b38fbc8e2c7ff66b?d=identicon)[JiLiZART](/maintainers/JiLiZART)

---

Top Contributors

[![JiLiZART](https://avatars.githubusercontent.com/u/62051?v=4)](https://github.com/JiLiZART "JiLiZART (6 commits)")

---

Tags

styleimageBehavioryii

### Embed Badge

![Health badge](/badges/artkost-yii2-image-style-behavior/health.svg)

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

###  Alternatives

[raoul2000/yii2-jcrop-widget

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

10248.3k2](/packages/raoul2000-yii2-jcrop-widget)[sadovojav/yii2-image-thumbnail

Yii2 image thumbnail component

2142.1k](/packages/sadovojav-yii2-image-thumbnail)[noam148/yii2-image-resize

A Yii2 component for resizing images (on the fly)

1144.6k7](/packages/noam148-yii2-image-resize)[sjaakp/yii2-illustrated-behavior

ActiveRecord Behavior with associated Widget for Yii2.

423.1k](/packages/sjaakp-yii2-illustrated-behavior)[maxmirazh33/yii2-uploadable-cropable-image

Yii2 extension for upload and crop images

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

PHPackages © 2026

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