public function init() { parent::init(); $this->crop = (bool) $this->crop; $this->preview = (bool) $this->preview; if ($this->crop) { $this->preview = true; $this->options['accept'] = 'image/*'; } else { // without crop control $this->options['autoUpload'] = true; } if (is_array($this->previewSize) && count($this->previewSize) >= 2) { $normalizePreviewSize = function ($value) { $value = intval($value); if ($value < 50 or $value > 500) { $value = 200; } return $value; }; $this->previewSize = array_map($normalizePreviewSize, $this->previewSize); } else { $this->previewSize = [200, 200]; } }
public function init() { parent::init(); $this->sortUrl = Url::toRoute('/fp/base/sort', true); }