Can not insert/edit image while using yii2-tinymce-widget with ElFinder file manager
polinwei opened this issue · comments
While I edit content in tinymce , when I want to insert/edit image , I got 404
Why did you get 404?
What extensions do you use? How do you insert an image?
Check the path settings.
The question is not in this thread. And here yii2-advanced-start?)
Yes
Elfinder is not configured correctly
Show the TinyMCE connection code in View
Show the code from the module's init section
Show the rules from the Bootstrap.php file of the module
I follow your recommend. It is workable in yii2-advanced
common\config\main
'controllerMap' => [
'elfinder' => [
'class' => 'mihaildev\elfinder\Controller',
'access' => ['@'], //Global file manager access @ - for authorized , ? - for guests , to open to all ['@', '?']
'disabledCommands' => ['netmount'], //disabling unnecessary commands https://github.com/Studio-42/elFinder/wiki/Client-configuration-options#commands
'roots' => [
[
'baseUrl'=> (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]",
'basePath'=>'@frontend/web',
'path' => 'files/global',
'name' => 'Global'
],
[
'class' => 'mihaildev\elfinder\volume\UserPath',
'path' => 'files/user_{id}',
'name' => 'My Documents'
],
[
'path' => 'files/some',
'name' => ['category' => 'my','message' => 'app'] //перевод Yii::t($category, $message)
],
[
'path' => 'files/some',
'name' => ['category' => 'my','message' => 'app'], // Yii::t($category, $message)
'access' => ['read' => '*', 'write' => 'UserFilesAccess'] // * - for all, otherwise the access check in this example can be seen by all users with rights only UserFilesAccess
]
],
'watermark' => [
'source' => __DIR__.'/logo.png', // Path to Water mark image
'marginRight' => 5, // Margin right pixel
'marginBottom' => 5, // Margin bottom pixel
'quality' => 95, // JPEG image save quality
'transparency' => 70, // Water mark image transparency ( other than PNG )
'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field )
'targetMinPixel' => 200 // Target image minimum pixel size
]
]
],
Bootstrap.php
namespace modules\blog;
use yii\base\BootstrapInterface;
class Bootstrap implements BootstrapInterface
{
/**
* @inheritdoc
*/
public function bootstrap($app)
{
// i18n
$app->i18n->translations['modules/blog/*'] = [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@modules/blog/messages',
'fileMap' => [
'modules/blog/module' => 'module.php',
],
];
// Rules
$app->getUrlManager()->addRules(
[
// blog backend
'blog/post' => 'blog/post/index',
// CRUD
'blog/post/<_a:[\w\-]+>' => 'blog/post/<_a>',
'blog/comment' => 'blog/comment/index',
'blog/comment/<_a:[\w\-]+>' => 'blog/comment/<_a>',
]
);
}
}
Try adding a rule to common\config\main
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'normalizer' => [
'class' => 'yii\web\UrlNormalizer',
'action' => \yii\web\UrlNormalizer::ACTION_REDIRECT_PERMANENT,
],
'enableStrictParsing' => true,
'rules' => [
// Rule Elfinder
'elfinder' => 'elfinder',
'elfinder/<_a:[\w\-]+>' => 'elfinder/<_a>',
],
],
Upd
Connect Elfinder to the module
Now I will plug and skim the example
Try it with my module
https://github.com/Dominus77/fm
How to integrate with dominus77/yii2-tinymce-widget?
Similarly, as indicated in README.md by dominus77/yii2-tinymce-widget
//...
'fileManager' => [
'class' => \dominus77\tinymce\components\MihaildevElFinder::className(),
'controller' => Url::to('/fm/elfinder'), // << Link to module fm
'title' => 'File Manager',
//'width' => 900,
//'height' => 600,
'resizable' => 'yes',
],
It is workable . WOW !! Cool
Does Dominus77/fm which can plugin yii2-advanced-start ?
So !! Now I can remove the mihaildev/yii2-elfinder extension ?
no
The module works with this extension, it's just one of the ways to integrate
Thanks.!!