/** * Return options array for fileapi * @return array */ private function generateOptionsArray() { if (empty($this->options)) { return []; } $return = []; $return['imageAutoOrientation'] = false; if (!isset($this->options['multiple'])) { $this->options['multiple'] = true; } if ($this->options['multiple'] === false) { $this->options['maxFiles'] = 1; $this->options['multiple'] = true; // hack, because if false you can add many files, but uploaded will be only the last one. } $this->multiple = $this->options['multiple']; foreach ($this->options as $option_name => $option_value) { if (!in_array($option_name, $this->options_allowed)) { continue; } if ($option_name == 'maxSize') { $option_value = FileHelper::sizeToBytes($option_value); } $return[$option_name] = $option_value; } return $return; }
private function generateOptionsArray() { if (empty($this->options)) { return []; } $return = []; $this->options['maxFiles'] = 1; $this->multiple = false; $return['imageAutoOrientation'] = false; foreach ($this->options as $option_name => $option_value) { if (!in_array($option_name, $this->options_allowed)) { continue; } if ($option_name == 'maxSize') { $option_value = FileHelper::sizeToBytes($option_value); } $return[$option_name] = $option_value; } return $return; }