PHPackages                             assayer-pro/yii2-easy-thumbnail-image-helper - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. assayer-pro/yii2-easy-thumbnail-image-helper

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

assayer-pro/yii2-easy-thumbnail-image-helper
============================================

Yii2 helper for creating and caching thumbnails on real time

1.2.0(8y ago)034MITPHP

Since Nov 12Pushed 8y ago1 watchersCompare

[ Source](https://github.com/assayer-pro/yii2-easy-thumbnail-image-helper)[ Packagist](https://packagist.org/packages/assayer-pro/yii2-easy-thumbnail-image-helper)[ RSS](/packages/assayer-pro-yii2-easy-thumbnail-image-helper/feed)WikiDiscussions develop Synced yesterday

READMEChangelog (1)Dependencies (3)Versions (7)Used By (0)

Easy Thumbnail Image Helper for Yii2
====================================

[](#easy-thumbnail-image-helper-for-yii2)

Yii2 helper for creating and caching thumbnails on real time.

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

[](#installation)

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

- Either run

```
php composer.phar require "assayer-pro/yii2-easy-thumbnail-image-helper" "*"

```

or add

```
"assayer-pro/yii2-easy-thumbnail-image-helper" : "*"
```

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

- Add a new component in `components` section of your application's configuration file (optional), for example:

```
'components' => [
    'thumbnail' => [
        'class' => 'assayerpro\thumbnail\EasyThumbnailImage',
        'cacheAlias' => 'assets/gallery_thumbnails',
        'quality' => 90,
    ],
],
```

It is necessary if you want to set global helper's settings for the application.

Usage
-----

[](#usage)

For example:

```
use assayerpro\thumbnail\EasyThumbnailImage;

echo Yii::$app->thumbnail->thumbnailImg(
    $model->pictureFile,
    50,
    50,
    EasyThumbnailImage::THUMBNAIL_OUTBOUND,
    ['alt' => $model->pictureName]
);
```

or

```
use assayerpro\thumbnail\EasyThumbnailImage;

echo Yii::$app->thumbnail->thumbnailImg(
    'http://...',
    50,
    50,
    EasyThumbnailImage::THUMBNAIL_OUTBOUND,
);
```

If one of thumbnail dimensions is set to null, another one is calculated automatically based on aspect ratio of original image. Note that calculated thumbnail dimension may vary depending on the source image in this case.

```
use assayerpro\thumbnail\EasyThumbnailImage;

echo Yii::$app->thumbnail->thumbnailImg(
    $model->pictureFile,
    50,
    null
);
```

If both dimensions are specified, resulting thumbnail would be exactly the width and height specified. How it's achieved depends on the mode.

For other functions please see the source code.

If you want to handle errors that appear while converting to thumbnail by yourself, please make your own class and inherit it from EasyThumbnailImage. In your class replace only protected method errorHandler. For example

```
class ThumbHelper extends \assayerpro\thumbnail\EasyThumbnailImage
{

    protected static function errorHandler($error, $filename)
    {
        if ($error instanceof \assayerpro\thumbnail\FileNotFoundException) {
            return \yii\helpers\Html::img('@web/images/notfound.png');
        } else {
            $filename = basename($filename);
            return \yii\helpers\Html::a($filename,"@web/files/$filename");
        }
    }
}
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

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

Every ~211 days

Total

5

Last Release

2988d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c8d4c8523235a0cdf2e362f2e5706e31ce3b6257ad9f2856421df383c7a615a8?d=identicon)[assayer-pro](/maintainers/assayer-pro)

---

Top Contributors

[![serge-larin](https://avatars.githubusercontent.com/u/6086715?v=4)](https://github.com/serge-larin "serge-larin (16 commits)")[![himiklab](https://avatars.githubusercontent.com/u/6266409?v=4)](https://github.com/himiklab "himiklab (12 commits)")[![worstinme](https://avatars.githubusercontent.com/u/2964518?v=4)](https://github.com/worstinme "worstinme (3 commits)")[![vkabachenko](https://avatars.githubusercontent.com/u/9642019?v=4)](https://github.com/vkabachenko "vkabachenko (1 commits)")

---

Tags

thumbnailhelperimageyii2

### Embed Badge

![Health badge](/badges/assayer-pro-yii2-easy-thumbnail-image-helper/health.svg)

```
[![Health](https://phpackages.com/badges/assayer-pro-yii2-easy-thumbnail-image-helper/health.svg)](https://phpackages.com/packages/assayer-pro-yii2-easy-thumbnail-image-helper)
```

PHPackages © 2026

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