PHPackages                             codigowww/yii2-image-manager - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. codigowww/yii2-image-manager

ActiveYii2-extension[File &amp; Storage](/categories/file-storage)

codigowww/yii2-image-manager
============================

A Yii2 module/widget for upload and cropping images

1.2.15(7y ago)117BSD-3-ClausePHP

Since Sep 25Pushed 7y agoCompare

[ Source](https://github.com/codigowww/yii2-image-manager)[ Packagist](https://packagist.org/packages/codigowww/yii2-image-manager)[ Docs](https://github.com/noam148/yii2-image-manager)[ RSS](/packages/codigowww-yii2-image-manager/feed)WikiDiscussions master Synced today

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

Image manager for Yii2
======================

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

A Yii2 module/widget for upload, manage and cropping images

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

[](#installation)

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

- Either run

```
php composer.phar require "noam148/yii2-image-manager" "*"

```

or add

```
"noam148/yii2-image-manager" : "*"
```

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

- Run the migrate to create the ImageManager table

```
yii migrate --migrationPath=@noam148/imagemanager/migrations

```

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

```
'components' => [
    'imagemanager' => [
		'class' => 'noam148\imagemanager\components\ImageManagerGetPath',
		//set media path (outside the web folder is possible)
		'mediaPath' => '/path/where/to/store/images/media/imagemanager',
        //path relative web folder. In case of multiple environments (frontend, backend) add more paths
        'cachePath' =>  ['assets/images', '../../frontend/web/assets/images'],
		//use filename (seo friendly) for resized images else use a hash
		'useFilename' => true,
		//show full url (for example in case of a API)
		'absoluteUrl' => false,
		'databaseComponent' => 'db' // The used database component by the image manager, this defaults to the Yii::$app->db component
	],
],
```

and in `modules` section, for example:

```
'modules' => [
	'imagemanager' => [
		'class' => 'noam148\imagemanager\Module',
		//set accces rules ()
		'canUploadImage' => true,
		'canRemoveImage' => function(){
			return true;
		},
		'deleteOriginalAfterEdit' => false, // false: keep original image after edit. true: delete original image after edit
		// Set if blameable behavior is used, if it is, callable function can also be used
		'setBlameableBehavior' => false,
		//add css files (to use in media manage selector iframe)
		'cssFiles' => [
			'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css',
		],
	],
],
```

Usage
-----

[](#usage)

To reach the imagemanager module go to:

```
http://www.example.com/imagemanager

```

[![Image manager module](/docs/images/img_doc-image-manager.jpg)](/docs/images/img_doc-image-manager.jpg)[![Image manager module cropper](/docs/images/img_doc-image-manager-crop.jpg)](/docs/images/img_doc-image-manager-crop.jpg)

To load the image picker see below (make sure you have a field in you table where the module can store 'id' of the ImageManager table):

```
echo $form->field($model, 'ImageManager_id_avatar')->widget(\noam148\imagemanager\components\ImageManagerInputWidget::className(), [
	'aspectRatio' => (16/9), //set the aspect ratio
    'cropViewMode' => 1, //crop mode, option info: https://github.com/fengyuanchen/cropper/#viewmode
	'showPreview' => true, //false to hide the preview
	'showDeletePickedImageConfirm' => false, //on true show warning before detach image
]);
```

[![Image widget](/docs/images/img_doc-image-widget.jpg)](/docs/images/img_doc-image-widget.jpg)[![Image widget popup](/docs/images/img_doc-image-widget-popup.jpg)](/docs/images/img_doc-image-widget-popup.jpg)

If you want to use a image:

```
/*
 * $ImageManager_id (id that is store in the ImageManager table)
 * $width/$height width height of the image
 * $thumbnailMode: "outbound", "inset" or "{horz}:{vert}" where {horz} is one from "left", "center", "right" and {vert} is one from "top", "center", "bottom"
 */
\Yii::$app->imagemanager->getImagePath($ImageManager_id, $width, $height,$thumbnailMode)
```

Support CKEditor &amp; TinyMce
------------------------------

[](#support-ckeditor--tinymce)

For using the filebrowser in CKEditor add the filebrowserImageBrowseUrl to the clientOptions of the CKEditor widget. I test it only for the CKEditor from 2amigOS but it need to work on other CKEditor widgets.

```
use dosamigos\ckeditor\CKEditor;

 echo $form->field($model, 'text')->widget(CKEditor::className(), [
	'options' => ['rows' => 6],
	'preset' => 'basic',
	'clientOptions' => [
		'filebrowserImageBrowseUrl' => yii\helpers\Url::to(['imagemanager/manager', 'view-mode'=>'iframe', 'select-type'=>'ckeditor']),
	]
]);
```

For using the filebrowser in TinyMce add the file\_browser\_callback to the clientOptions of the TinyMce widget. I test it only for the TinyMce from 2amigOS but it need to work on other TinyMce widgets. (don't forget add 'image' to your 'plugins' array)

```
use dosamigos\tinymce\TinyMce;

echo $form->field($model, 'text')->widget(TinyMce::className(), [
	'options' => ['rows' => 6],
	'language' => 'nl',
	'clientOptions' => [
		'file_browser_callback' => new yii\web\JsExpression("function(field_name, url, type, win) {
			window.open('".yii\helpers\Url::to(['imagemanager/manager', 'view-mode'=>'iframe', 'select-type'=>'tinymce'])."&tag_name='+field_name,'','width=800,height=540 ,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no');
		}"),
		'plugins' => [
			"advlist autolink lists link charmap print preview anchor",
			"searchreplace visualblocks code fullscreen",
			"insertdatetime media table contextmenu paste image"
		],
		'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
	]
]);
```

**If you got questions, tips or feedback? Please, let me know!**

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 61% 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 ~35 days

Recently: every ~1 days

Total

26

Last Release

2645d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/30121fdb9d1628b67269a9e16776b4986d6398d9273950d8d59ea26f47152a3a?d=identicon)[codigowww](/maintainers/codigowww)

---

Top Contributors

[![noam148](https://avatars.githubusercontent.com/u/10885039?v=4)](https://github.com/noam148 "noam148 (36 commits)")[![bvanleeuwen1995](https://avatars.githubusercontent.com/u/10004134?v=4)](https://github.com/bvanleeuwen1995 "bvanleeuwen1995 (15 commits)")[![codigowww](https://avatars.githubusercontent.com/u/46723539?v=4)](https://github.com/codigowww "codigowww (6 commits)")[![gugatxr](https://avatars.githubusercontent.com/u/19287118?v=4)](https://github.com/gugatxr "gugatxr (1 commits)")[![igorveremsky](https://avatars.githubusercontent.com/u/13087365?v=4)](https://github.com/igorveremsky "igorveremsky (1 commits)")

---

Tags

imagemanageruploadyii2extensionmodulewidgetcrop

### Embed Badge

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

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

###  Alternatives

[noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

12914.8k](/packages/noam148-yii2-image-manager)[sjaakp/yii2-illustrated-behavior

ActiveRecord Behavior with associated Widget for Yii2.

423.1k](/packages/sjaakp-yii2-illustrated-behavior)[budyaga/yii2-cropper

Yii-Framework widget for uploading and cropping images

4368.5k4](/packages/budyaga-yii2-cropper)[liyunfang/yii2-upload-behavior

Upload behavior for Yii 2

161.7k](/packages/liyunfang-yii2-upload-behavior)[rkit/filemanager-yii2

FileManager for Yii2

181.3k](/packages/rkit-filemanager-yii2)

PHPackages © 2026

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