示例#1
0
    $start = $request->params('s');
    $end = $request->params('e');
    $series = new Series($conf, $series_path, $app_base_url, $start, $end);
    if ($img !== null) {
        $series->setImage($img);
    }
    $infos = $series->getInfos();
    echo json_encode($infos);
});
$app->get('/ajax/image/infos/:image_params+', function ($img_params) use($app, $conf) {
    $img = array_pop($img_params);
    $path = null;
    if (count($img_params) > 0) {
        $path = implode('/', $img_params) . '/';
    }
    $rcontents = Picture::getRemoteInfos($conf->getRemoteInfos(), $path, $img);
    $infos = array();
    if ($rcontents !== null) {
        $infos['remote'] = $rcontents;
    }
    echo json_encode($infos);
});
$app->get('/ajax/image/comments/:image_params+', function ($img_params) use($app, $conf) {
    $img = array_pop($img_params);
    $path = null;
    if (count($img_params) > 0) {
        $path = implode('/', $img_params) . '/';
    }
    $rcontents = Picture::getRemoteComments($conf->getRemoteInfos(), $path, $img);
    echo json_encode($rcontents);
});
示例#2
0
 /**
  * Test for remote informations stuff
  *
  * @return void
  */
 public function testRemoteInfos()
 {
     $uri = Viewer\Picture::getRemoteInfosURI($this->_conf->getRemoteInfos(), null, 'tech.jpg');
     $this->string($uri)->isIdenticalTo('http://UT.bach.localhost/infosimage/tech.jpg');
     $rinfos = Viewer\Picture::getRemoteInfos($this->_conf->getRemoteInfos(), null, 'tech.jpg');
     $this->boolean($rinfos)->isFalse();
     $rinfos = Viewer\Picture::getRemoteInfos($this->_conf->getRemoteInfos(), null, 'tech.jpg', TESTS_DIR . '/data/bach_remote_infos');
     $this->string($rinfos)->isIdenticalTo('<a target="_blank" href="http://UT.bach.localhost/document/test"' . '>Test</a>' . "\n");
     $config_path = APP_DIR . '/../tests/config/config-remotepleade.yml';
     $conf = new Viewer\Conf($config_path);
     $rinfos = Viewer\Picture::getRemoteInfos($conf->getRemoteInfos(), null, 'tech.jpg');
     $this->boolean($rinfos)->isFalse();
     $rinfos = Viewer\Picture::getRemoteInfos($conf->getRemoteInfos(), null, 'tech.jpg', TESTS_DIR . '/data/pleade_remote_infos');
     $this->string($rinfos)->isIdenticalTo('<a href="http://pleade.test.localhost/ead.html?id=Test&amp;c=' . 'Test_1" title="">Test</a>');
 }
示例#3
0
 /**
  * Retrieve informations about current series
  *
  * @return array
  */
 public function getInfos()
 {
     if (!isset($this->_current)) {
         throw new \RuntimeException(_('Series has not been initialized yet.'));
     } else {
         $infos = array('path' => $this->_path, 'current' => $this->_current, 'next' => $this->getNextImage(), 'prev' => $this->getPreviousImage(), 'count' => $this->getCount(), 'position' => $this->getCurrentPosition());
         $rinfos = $this->_conf->getRemoteInfos();
         if ($rinfos !== false) {
             $rcontents = Picture::getRemoteInfos($rinfos, $this->_path, $this->_current);
             if ($rcontents !== null) {
                 $infos['remote'] = $rcontents;
             }
         }
         return $infos;
     }
 }