2017 © Pedro Peláez
 

yii2-extension yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

image

kolyasiryk/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  • Wednesday, July 25, 2018
  • by kolyasiryk
  • Repository
  • 2 Watchers
  • 1 Stars
  • 134 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 32 Forks
  • 0 Open issues
  • 60 Versions
  • 6 % Grown

The README.md

Image manager for Yii2

A Yii2 module/widget for upload, manage and cropping images, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

  • Either run
php composer.phar require "kolyasiryk/yii2-image-manager-mongo" "*" 

or add, (*3)

"kolyasiryk/yii2-image-manager-mongo" : "*"

to the require section of your application's composer.json file., (*4)

  • 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 to store the cache images
        'cachePath' => ['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:, (*5)

'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

To reach the imagemanager module go to:, (*6)

http://www.example.com/imagemanager

Image manager module Image manager module cropper, (*7)

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):, (*8)

echo $form->field($model, 'ImageManager_id_avatar')->widget(\noam148\imagemanager\widgets\ImageManagerInput::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
    'multiple' => false,
    'models' => $models, //selected models
]);

Image widget Image widget popup, (*9)

If you want to use a image:, (*10)

/*
 * $ImageManager_id (id that is store in the ImageManager table)
 * $width/$height width height of the image
 * $thumbnailMode = "outbound" or "inset"
 */
\Yii::$app->imagemanager->getImagePath($ImageManager_id, $width, $height,$thumbnailMode)

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., (*11)

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), (*12)

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!, (*13)

The Versions

21/12 2017
20/12 2017

v2.3

2.3.0.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

13/12 2017

v2.2

2.2.0.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

01/12 2017

v2.1.18

2.1.18.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

01/12 2017

v2.1.17

2.1.17.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

01/12 2017

v2.1.16

2.1.16.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

01/12 2017

v2.1.15

2.1.15.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

29/11 2017

v2.1.14

2.1.14.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

29/11 2017

v2.1.13

2.1.13.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

28/11 2017

v2.1.12

2.1.12.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

28/11 2017

v2.1.11

2.1.11.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

22/11 2017

v2.1.10

2.1.10.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

21/11 2017

v2.1.9

2.1.9.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

21/11 2017

v2.1.8

2.1.8.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

16/11 2017

v2.1.7

2.1.7.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

16/11 2017

v2.1.6

2.1.6.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

10/11 2017

v2.1.5

2.1.5.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

01/11 2017

v2.1.4

2.1.4.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

01/11 2017

v2.1.3

2.1.3.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

01/11 2017

v2.1.2

2.1.2.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

01/11 2017

v2.1.1

2.1.1.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

31/10 2017

v2.1

2.1.0.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

31/10 2017

v2.0

2.0.0.0 https://github.com/KolyaSirik/yii2-image-manager-mongo

A Yii2 module/widget for upload and cropping images for MongoDB

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image mongo crop manager

11/06 2017

1.2.6

1.2.6.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

18/05 2017

1.2.5

1.2.5.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

14/05 2017

1.2.4

1.2.4.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

10/05 2017

1.2.3

1.2.3.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

23/04 2017

1.2.2

1.2.2.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

01/04 2017

dev-tags

dev-tags https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

23/02 2017

1.2.1

1.2.1.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

23/02 2017

1.2.0

1.2.0.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

25/01 2017

1.1.2

1.1.2.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

24/11 2016

1.1.1

1.1.1.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

24/11 2016

1.1.0

1.1.0.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

20/11 2016

1.0.6

1.0.6.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

30/10 2016

1.0.5

1.0.5.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

20/10 2016

1.0.4

1.0.4.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

20/10 2016

1.0.3

1.0.3.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

25/09 2016

1.0.2

1.0.2.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

25/09 2016

1.0.1

1.0.1.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager

25/09 2016

1.0.0

1.0.0.0 https://github.com/noam148/yii2-image-manager

A Yii2 module/widget for upload and cropping images

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 upload module widget image crop manager