コード例 #1
0
 /**
  * @throws InvalidConfigException
  */
 public function init()
 {
     parent::init();
     if (empty($this->bucket) || empty($this->username) || empty($this->domain)) {
         throw new InvalidConfigException('bucket|username|domain is required');
     }
     if ($this->autoGenerateFilename && empty($this->filenameFormat)) {
         throw new InvalidConfigException('filenameFormat is required when autoGenerateFilename is true');
     }
     if (stripos($this->domain, 'http:') !== 0 && stripos($this->domain, 'https:') !== 0) {
         $this->domain = ($this->enableSSL ? 'https' : 'http') . '://' . ltrim($this->domain, '/');
     }
     $this->_handle = new UpYunClient($this->bucket, $this->username, $this->password, $this->endpoint, $this->timeout);
 }
コード例 #2
0
 /**
  * @param string $file
  * @param string $prefix
  * @param string $suffix
  * @return bool|array Array key is width, height, type, frames, url, file, path, name
  */
 protected function uploadFile($file, $prefix, $suffix)
 {
     return $this->storage->write($this->tempName, $file, $this->getExtension(), $prefix, $suffix);
 }