V
V
Veronika Stepanovna2016-10-08 15:54:22
Yii
Veronika Stepanovna, 2016-10-08 15:54:22

How to upload images in yii2 using vova07\imperavi\Widget?

According to the documentation, inserted into the view

<?=$form->field($model, 'text')->label('Текст статьи')->widget(Widget::className(), [
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 300,
        'imageUpload' => Url::to(['/mycontrollername/image-upload']),
        'plugins' => [
            'imageupload',
            'imagemanager',
            'filemanager',
            'fontcolor',
            'fullscreen',
        ]
    ]
])->textArea(['value' => $post->text])?>

to controller:
public function actions()
{
    return [
        'image-upload' => [
            'class' => 'vova07\imperavi\actions\UploadAction',
            'url' => 'http://yii.loc/public/images/', // URL адрес папки где хранятся изображения.
            'path' => '@webroot/public/images', // Или абсолютный путь к папке с изображениями.
        ],
    ];
}

however, image loading does not work. There is a folder. Rights are set. Configured like normal. When I try to load a js window pops up with the inscription true. The image in the folder does not appear. What am I doing wrong and what could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-10-08
@sargss

Good evening.
If there are no errors and everything works as you say, then check the rights and paths, paths and rights ...
To the directory 0777.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question