2017 © Pedro Peláez
 

yii2-extension yii2-redactor-imgmanager

Redactor with image manager, Image select widget and Multiple image placing widgets in one extension

image

murodov20/yii2-redactor-imgmanager

Redactor with image manager, Image select widget and Multiple image placing widgets in one extension

  • Saturday, December 9, 2017
  • by murodov20
  • Repository
  • 2 Watchers
  • 0 Stars
  • 13 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 8 % Grown

The README.md

Imperavi Redactor with image manager functionality via db

Redactor with image manager, Image select widget and Multiple image placing widgets in one extension, (*1)

Thanks to @vova07 for yii2-imperavi-redactor and Thanks to @sam_dark and @yiiext for purchasing OEM license, (*2)

Imperavi Redactor is the paid commercial extension, but some developers of Yii bought OEM license for for all Yii developers. That's why this version of Redactor has OEM license and you can use it for all your commercial projects. But you cann't update Redactor to new version., (*3)

Installation

Don't use this extension in production. Extension under development. If you want to go hard with this, you can use version 1.0.0., (*4)

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

  • Development:

Either run, (*6)

    php composer.phar require murodov20/yii2-redactor-imgmanager "*"

or add, (*7)

    "murodov20/yii2-redactor-imgmanager": "*"
  • Production:
    php composer.phar require murodov20/yii2-redactor-imgmanager "^1.0"

or add, (*8)

    "murodov20/yii2-redactor-imgmanager": "^1.0"

to the require section of your composer.json file., (*9)

After this run migration:, (*10)

php yii migrate --migrationPath="@vendor/murodov20/yii2-redactor-imgmanager/migrations"

Usage

Once the extension is installed, simply use it in your code., (*11)

Simple configuration:, (*12)

First of all, you need to add photo-manager module to your project:, (*13)

'modules' => [
        ...
        'photo-manager' => [
            'class' => '\murodov20\redactor\PhotoManagerModule',
            'urlManager' => 'urlManager', //optional
        ]
        ...
    ],

In Redactor widget, Redactor will load image's src, In MultiplePhoto and PhotoInput widgets will be load image id., (*14)

Using widgets:, (*15)

RedactorWidget:, (*16)

= $form
    ->field($model, 'content')
    ->textarea(['rows' => 6])
    ->widget(MRedactorWidget::className(), [
            'settings' => [
                'lang' => 'ru',
                'minHeight' => 200,
                'imageUpload' => Yii::$app->urlManager->createUrl(['/photo-manager/image/ajax-upload']),
                'managerUrl' => Yii::$app->urlManager->createUrl(['/photo-manager/image/get']),
                'plugins' => [
                    'fontfamily',
                    'fontsize',
                    'fontcolor',
                    'table',
                    'clips',
                    'textexpander',
                    'video',
                    'fullscreen',
                    'manager'
                ]
            ]
        ]) ?>

PhotoInputWidget:, (*17)

= PhotoInputWidget::widget(
        [
            'model' => $model,
            'attribute' => 'image'
        ]
    ) ?>

MultiplePhoto:, (*18)

= MultiplePhoto::widget([
        'model' => $model,
        'attribute' => 'images'
    ]) ?>

If you are using MultiplePhoto widget, 'attribute' param must be an array. You can access to values like this (eg. in Controller):, (*19)

$model = new Post();
if ($model->load(Yii::$app->request->post()) && $model->save){
    foreach ($model->images as $image) {
        $slider = new PostSlider();
        $slider->post_id = $model->id;
        $slider->image_id = $image;
        $slider->save();
    }
}

The Versions

09/12 2017

dev-master

9999999-dev https://github.com/murodov20/yii2-redactor-imgmanager

Redactor with image manager, Image select widget and Multiple image placing widgets in one extension

  Sources   Download

MIT

The Requires

 

by Mirjalol Murodov

extension yii2 imperavi redactor image manager

20/09 2017

1.0.0

1.0.0.0 https://github.com/murodov20/yii2-redactor-imgmanager

Redactor with image manager, Image select widget and Multiple image placing widgets in one extension

  Sources   Download

MIT

The Requires

 

by Mirjalol Murodov

extension yii2 imperavi redactor image manager