Blame view

backend/components/ImageUploader.php 1.05 KB
4828b892   Mihail   after merge with ...
1
2
3
4
5
6
7
8
9
10
11
12
  <?php
  /**
   * Created by PhpStorm.
   * User: vitaliy
   * Date: 05.10.15
   * Time: 16:18
   */
  
  namespace backend\components;
  use yii\base\Widget;
  
  
89d4b5ac   Administrator   VItaliy 25.11.2015
13
  class ImageUploader extends Widget
4828b892   Mihail   after merge with ...
14
  {
bc1a3552   Administrator   Importers CRUD
15
16
      public $height = 0;
      public $width = 0;
4828b892   Mihail   after merge with ...
17
18
19
      public $field;
      public $file;
      public $model;
992d7eaa   Administrator   Importers CRUD
20
      public $multi = false;
4c977682   Administrator   Importers CRUD
21
      public $gallery;
ad4b55bc   Administrator   VItaliy 26.11.2015
22
      public $name = 'Add file...';
4828b892   Mihail   after merge with ...
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  
      public function init(){
  
          parent::init();
  
      }
  
  
      public function run()
      {
  
          return $this->render('image_sizer',
              [
                  'model'=>$this->model,
                  'field' => $this->field,
4828b892   Mihail   after merge with ...
38
                  'height' => $this->height,
992d7eaa   Administrator   Importers CRUD
39
                  'width' => $this->width,
ad4b55bc   Administrator   VItaliy 26.11.2015
40
41
                  'multi'  => $this->multi,
                  'name'  => $this->name
4828b892   Mihail   after merge with ...
42
43
44
45
              ]);
  
      }
  
bc1a3552   Administrator   Importers CRUD
46
47
48
49
50
51
52
53
54
55
56
      public function getGallery(){
          if($this->gallery){
              $array = explode(",", $this->gallery);
              if(count($array) > 1){
                  array_pop($array);
              }
              return $array;
          } else {
              return array();
          }
  
4c977682   Administrator   Importers CRUD
57
58
      }
  
4828b892   Mihail   after merge with ...
59
  }