PHPackages                             yii-ext/yii-easyimage - 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. [Caching](/categories/caching)
4. /
5. yii-ext/yii-easyimage

ActiveYii-extension[Caching](/categories/caching)

yii-ext/yii-easyimage
=====================

Yii Framework extension for easy creating and caching thumbnails on real time.

0.2.2(11y ago)037New BSDPHPPHP &gt;=5.1.0

Since May 27Pushed 11y ago1 watchersCompare

[ Source](https://github.com/yii-ext/yii-easyimage)[ Packagist](https://packagist.org/packages/yii-ext/yii-easyimage)[ Docs](https://github.com/yii-ext/yii-easyimage)[ RSS](/packages/yii-ext-yii-easyimage/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (6)DependenciesVersions (7)Used By (0)

yii-easyimage
=============

[](#yii-easyimage)

You don't need to create many types of thumbnails for images in your project. You can create a thumbnail directly in the `View`. Thumbnail will automatically cached. It's easy!

Features:

- Easy to use
- Support `GD` and `Imagick`
- Automaticly thumbnails caching
- Cache sorting to subdirectories
- Support `Retina` displays
- Based on Kohana Image Library.

\##Installing and configuring Extract the `EasyImage` folder under `protected/extensions`

Add the following to your config file `components` section:

```
'components'=>array(
//...
  'easyImage' => array(
    'class' => 'application.extensions.easyimage.EasyImage',
    'password' => 'password' // used for image action
    //'driver' => 'GD',
    //'quality' => 100,
    //'cachePath' => '/assets/easyimage/',
    //'cacheTime' => 2592000,
    //'retinaSupport' => false,
  ),
```

and the following to `import` section:

```
'import' => array(
  //...
  'ext.easyimage.EasyImage'
),
```

\##Usage ###InstanceOf

```
$image = new EasyImage('/path/to/image.jpg');
$image->resize(100, 100);
$image->save('/full/path/to/thumb.jpg');
```

\####Parameters

- string `$file` required - Image file path
- string `$driver` - Driver: `GD`, `Imagick`

### ThumbOf

[](#thumbof)

You can create a thumbnail directly in the `View`:

```
// Create and autocache
Yii::app()->easyImage->thumbOf('/path/to/image.jpg', array('rotate' => 90));

// or
Yii::app()->easyImage->thumbOf('image.jpg', array('rotate' => 90),  array('class' => 'image'));

// or
Yii::app()->easyImage->thumbOf('image.png',
  array(
    'resize' => array('width' => 100, 'height' => 100),
    'rotate' => array('degrees' => 90),
    'sharpen' => 50,
    'background' => '#ffffff',
    'type' => 'jpg',
    'quality' => 60,
  ));
```

**Note.** This method return [CHtml::image()](http://www.yiiframework.com/doc/api/1.1/CHtml)

\####Parameters

- string `$file` required - Image file path
- array `$params` - Image manipulation methods. See [Methods](README.md#methods)
- array `$htmlOptions` - options for CHtml::image()

### ThumbSrcOf

[](#thumbsrcof)

```
Yii::app()->easyImage->thumbSrcOf('image.jpg', array('crop' => array('width' => 100, 'height' => 100)));
```

**Note.** This method return path to image cached. ####Parameters

- string `$file` required - Image file path
- array `$params` - Image manipulation methods. See [Methods](README.md#methods)

\##Methods ###Resize

```
$image->resize(100, 100, EasyImage::RESIZE_AUTO);
```

```
Yii::app()->easyImage->thumbOf('image.jpg', array('resize' => array('width' => 100, 'height' => 100)));
```

\####Parameters

- integer `$width` - New width
- integer `$height` - New height
- integer `$master` - Master dimension: `EasyImage::RESIZE_NONE`, `EasyImage::RESIZE_WIDTH`, `EasyImage::RESIZE_HEIGHT`, `EasyImage::RESIZE_AUTO`, `EasyImage::RESIZE_INVERSE`, `EasyImage::RESIZE_PRECISE`

\###Crop

```
$image->crop(100, 100);
```

```
Yii::app()->easyImage->thumbOf('image.jpg', array('crop' => array('width' => 100, 'height' => 100)));
```

\####Parameters

- integer `$width` required - New width
- integer `$height` required - New height
- mixed `$offset_x` = `NULL` - Offset from the left
- mixed `$offset_y` = `NULL` - Offset from the top

\###Rotate

```
$image->rotate(45);
```

```
Yii::app()->easyImage->thumbOf('image.jpg', array('rotate' => array('degrees' => 45)));
// or
Yii::app()->easyImage->thumbOf('image.jpg', array('rotate' => 45));
```

\####Parameters

- integer `$degrees` required - Degrees to rotate: -360-360

\###Flip

```
$image->flip(EasyImage::FLIP_HORIZONTAL);
```

```
Yii::app()->easyImage->thumbOf('image.jpg', array('flip' => array('direction' => EasyImage::FLIP_HORIZONTAL)));
// or
Yii::app()->easyImage->thumbOf('image.jpg', array('flip' => EasyImage::FLIP_VERTICAL));
```

\####Parameters

- integer `$direction` required - Direction: `EasyImage::RESIZE_NONE`, `EasyImage::RESIZE_WIDTH`.

\###Sharpen

```
$image->sharpen(20);
```

```
Yii::app()->easyImage->thumbOf('image.jpg', array('sharpen' => array('amount' => 20)));
// or
Yii::app()->easyImage->thumbOf('image.jpg', array('sharpen' => 20));
```

\####Parameters

- integer `$amount` required - Amount to sharpen (percent): 1-100

\###Reflection

```
// Create a 50 pixel reflection that fades from 0-100% opacity
$image->reflection(50);

// Create a 50 pixel reflection that fades from 100-0% opacity
$image->reflection(50, 100, TRUE);

// Create a 50 pixel reflection that fades from 0-60% opacity
$image->reflection(50, 60, TRUE);
```

```
Yii::app()->easyImage->thumbOf('image.jpg', array('reflection' => array('height' => 50)));
// or
Yii::app()->easyImage->thumbOf('image.jpg', array('reflection'));
```

**Note.** By default, the reflection will be go from transparent at the top to opaque at the bottom. ####Parameters

- integer `$height` = `NULL` - Reflection height
- integer `$opacity` = `100` - Reflection opacity: 0-100
- boolean `$fade_in` = `FALSE` - `TRUE` to fade in, `FALSE` to fade out

\###Watermark

```
$mark = new EasyImage('watermark.png');
$image->watermark($mark, TRUE, TRUE);
// or
$image->watermark('watermark.png', 20, 20);
```

```
Yii::app()->easyImage->thumbOf('image.jpg', array('watermark' => array('watermark' => 'mark.png', 'opacity' => 50)));
```

**Note.** If no offset is specified, the center of the axis will be used. If an offset of `TRUE` is specified, the bottom of the axis will be used. ####Parameters

- mixed `$watermark` required - Watermark `EasyImage` instance or path to Image
- integer `$offset_x` = `NULL` - Offset from the left
- integer `$offset_y` = `NULL` - Offset from the top
- integer `$opacity` = `100` - Opacity of watermark: 1-100

\###Background

```
$image->background('#000', 50);
```

```
Yii::app()->easyImage->thumbOf('image.jpg', array('background' => array('color' => '#ffffff', 'opacity' => 50)));
// or
Yii::app()->easyImage->thumbOf('image.jpg', array('background' => '#ffffff'));
```

**Note** This is only useful for images with alpha transparency. ####Parameters

- string `$color` required - Hexadecimal color value
- integer `$opacity` = `100` - Background opacity: 0-100

\###Quality

```
Yii::app()->easyImage->thumbOf('image.jpg', array('quality' => 60)));
```

```
//not support: $image->quality(60);
// see $image->render(NULL, 60);
```

**Note** This is only useful for `JPG` images. ####Parameters

- integer required - Quality of image: 1-100

\###Type

```
Yii::app()->easyImage->thumbOf('image.png', array('type' => 'jpg')));
```

```
//not support: $image->type('jpg');
// see $image->render('jpg');
```

\####Parameters

- string required - Image type to return: `png`, `jpg`, `gif`, etc

\###Save

```
// Save the image as a PNG
$image->save('image.png');

// Overwrite the original image
$image->save();
```

\####Parameters

- string `$file` = `NULL` - New image path
- integer `$quality` = `100` - Quality of image: 1-100

\###Render

```
// Render the image at 50% quality
$data = $image->render(NULL, 50);

// Render the image as a PNG
$data = $image->render('png');
```

\####Parameters

- string `$type` = `NULL` - Image type to return: `png`, `jpg`, `gif`, etc
- integer `$quality` = `100` - Quality of image: 1-100

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~4 days

Total

6

Last Release

4347d ago

### Community

Maintainers

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

---

Top Contributors

[![zhdanovartur](https://avatars.githubusercontent.com/u/1068224?v=4)](https://github.com/zhdanovartur "zhdanovartur (16 commits)")[![dmitry-semenov](https://avatars.githubusercontent.com/u/17027799?v=4)](https://github.com/dmitry-semenov "dmitry-semenov (8 commits)")

---

Tags

thumbnailimagecacherealtimeextensionyii

### Embed Badge

![Health badge](/badges/yii-ext-yii-easyimage/health.svg)

```
[![Health](https://phpackages.com/badges/yii-ext-yii-easyimage/health.svg)](https://phpackages.com/packages/yii-ext-yii-easyimage)
```

###  Alternatives

[undefinedor/yii2-cached-active-record

The cached activeRecord for the Yii2 framework

102.6k](/packages/undefinedor-yii2-cached-active-record)

PHPackages © 2026

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