PHP code example of murodov20 / yii2-redactor-imgmanager

1. Go to this page and download the library: Download murodov20/yii2-redactor-imgmanager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

murodov20 / yii2-redactor-imgmanager example snippets


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


<?= $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::widget(
        [
            'model' => $model,
            'attribute' => 'image'
        ]
    ) 

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

$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();
	}
}


    php composer.phar 

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