Пример #1
0
 public function session($input)
 {
     $this->mergeConfig($input);
     $session = $input['optimus_uploader_files'];
     if ($session === null) {
         return [];
     }
     $return = [];
     foreach ($session as $file) {
         $fileObj = new RootFile($this->uploaderPath('/' . $file));
         $uploaderPath = str_replace('/' . $fileObj->getFilename(), '', $file);
         $fileObj->setUploaderPath($uploaderPath);
         $storage = $this->storage->get($fileObj);
         $id = \uniqid();
         if (is_array($storage) && isset($storage['error'])) {
             $return[] = array_merge(['uuid' => $id, 'name' => $fileObj->getFilename(), 'upload_path' => $file, 'type' => 'error', 'error_code' => $storage['error']], $storage);
         } else {
             $return[] = ['name' => $storage->getFilename(), 'upload_path' => sprintf('%s/%s', $storage->getUploaderPath(), $storage->getFilename()), 'file_type' => $storage->getType(), 'type' => 'session', 'thumbnailUrl' => $storage->getEdition('thumbnail')->getUrl(), 'uuid' => $id];
         }
     }
     return $return;
 }