/**
  * {@inheritDoc}
  */
 public function open(Response $response, $target = '', $tree = false, $init = false)
 {
     $target = $target ?: $this->driverOptions['path'];
     $url = $this->driverOptions['host'] . DIRECTORY_SEPARATOR . $this->driverOptions['path'] . DIRECTORY_SEPARATOR;
     $this->addOption('path', $target);
     $this->addOption('url', $url);
     $this->addOption('tmbURL', $url . $this->driverOptions['tmbPath'] . DIRECTORY_SEPARATOR);
     $dir = $this->getFileInfo($target);
     $response->setCwd($dir);
     $response->setFiles($this->scanDir($target));
     $response->appendFiles($this->scanDir($this->driverOptions['path']));
     if ($init) {
         $response->setUplMaxSize(ini_get('upload_max_filesize'));
     }
     if ($tree) {
         $this->tree($response, $this->driverOptions['path']);
     }
     return $response;
 }
 /**
  * get Gallery
  *
  * @param Response $response
  * @param string   $target
  */
 private function getGallery(Response $response, $target = '')
 {
     if ($target && ($gallery = $this->manager->getGallery(basename($target)))) {
         $response->setCwd($this->prepareGallery($gallery));
         $images = $gallery->getImages(true);
         foreach ($images as $img) {
             $this->addImages($response, $img, $this->driverOptions['rootName'] . DIRECTORY_SEPARATOR . basename($target));
         }
     }
 }