Example #1
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     if (!$this->model) {
         $this->model = new Media();
     }
     if ($this->ownerModel && !$this->inputContainer) {
         $this->inputContainer = '#' . Html::getInputId($this->ownerModel, $this->ownerModel->getUploadAttribute());
     }
     if ($this->ownerModel && !$this->inputName) {
         $this->inputName = Html::getInputName($this->ownerModel, $this->ownerModel->getUploadAttribute());
     }
     $this->clientOptions = ['autoUpload' => true, 'previewMaxWidth' => 120, 'previewMaxHeight' => 120, 'previewCrop' => true];
     $this->gallery = false;
     if ($this->baseUrl) {
         $this->url = $this->baseUrl . '/upload';
     }
     parent::init();
 }