Blame view

widgets/ImageUploader.php 1.6 KB
e10587b1   Yarik   first commit
1
  <?php

143c55a9   Yarik   Namespaces
2
3
4
5
6
7
8
9
10
11
12
13
      /**

       * Created by PhpStorm.

       * User: vitaliy

       * Date: 05.10.15

       * Time: 16:18

       */

      

      namespace artweb\artbox\file\widgets;

      

      use yii\base\Widget;

      

      class ImageUploader extends Widget

e10587b1   Yarik   first commit
14
      {

143c55a9   Yarik   Namespaces
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
49
50
51
52
53
54
55
56
57
58
59
60
61
          public $height = 0;

          public $width = 0;

          public $field;

          public $file;

          public $model;

          public $multi = false;

          public $gallery;

          public $size;

          public $name = 'Add file...';

          public $remover = 0;

          

          public function init()

          {

              

              parent::init();

              

          }

          

          public function run()

          {

              

              return $this->render(

                  'image_sizer',

                  [

                      'model'   => $this->model,

                      'size'    => $this->size,

                      'field'   => $this->field,

                      'height'  => $this->height,

                      'width'   => $this->width,

                      'multi'   => $this->multi,

                      'name'    => $this->name,

                      'remover' => $this->remover,

                  ]

              );

              

          }

          

          public function getGallery()

          {

              if ($this->gallery) {

                  $array = explode(",", $this->gallery);

                  if (count($array) > 1) {

                      array_pop($array);

                  }

                  return $array;

              } else {

                  return [];

e10587b1   Yarik   first commit
62
              }

143c55a9   Yarik   Namespaces
63
              

e10587b1   Yarik   first commit
64
          }

143c55a9   Yarik   Namespaces
65
66
          

      }