-
Notifications
You must be signed in to change notification settings - Fork 1
/
Module.php
48 lines (39 loc) · 809 Bytes
/
Module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
namespace dkhlystov\uploadimage;
use Yii;
/**
* Upload image module
*/
class Module extends \yii\base\Module
{
/**
* @var string Path to directory where images will be upload (relative to web root).
*/
public $uploadPath = '/upload';
/**
* @var integer Max file size for upload in MB. Default is 64;
*/
public $maxFileSize = 64;
/**
* @inheritdoc
*/
public function init()
{
parent::init();
static::addTranslation();
}
/**
* Adding translation to i18n
* @return void
*/
public static function addTranslation()
{
if (!isset(Yii::$app->i18n->translations['uploadimage'])) {
Yii::$app->i18n->translations['uploadimage'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en-US',
'basePath' => __DIR__ . '/messages',
];
}
}
}