Answer the question
In order to leave comments, you need to log in
YI2 how to add image via console?
There are no problems with adding pictures through the site, but if through the console, an error occurs:
Yii2 images module not found, may be you didn't add it to your config?
<?php
namespace rico\yii2images;
use yii\base\Exception;
trait ModuleTrait
{
/**
* @var null|\rico\yii2images\Module
*/
private $_module;
/**
* @return null|\rico\yii2images\Module
*/
protected function getModule()
{
if ($this->_module == null) {
$this->_module = \Yii::$app->getModule('yii2images');
}
if(!$this->_module){
throw new Exception("\n\n\n\n\nYii2 images module not found, may be you didn't add it to your config?\n\n\n\n");
}
return $this->_module;
}
}
Answer the question
In order to leave comments, you need to log in
1. The console application has its own config, you apparently didn’t declare the module in it
2. It’s not a fact that this module is ready to work through the console, but the error is still more likely about point 1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question