Exemple #1
0
 /**
  * Get image URL to display in web interface
  *
  * @param Series $series Current series
  * @param string $format Format to display
  *
  * @return string
  */
 public function getUrl(Series $series = null, $format = 'default')
 {
     $prefix = $this->_app_base_url . '/show/';
     $prefix .= $format . '/';
     if ($series) {
         $prefix .= $series->getPath() . '/';
     } else {
         if ($this->_path !== null) {
             $prefix .= $this->_path;
         }
     }
     return $prefix . $this->getName();
 }
Exemple #2
0
    }
    $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);
});
$app->get('/ajax/image/comment/bachURL', function () use($app, $conf) {
    $bachURL = $conf->getRemoteInfos();
    echo $bachURL['uri'];
});
$app->get('/ajax/series/:series/thumbs', function ($series_path) use($app, $conf, $app_base_url) {
    $request = $app->request;
    $start = $request->params('s');
    $end = $request->params('e');
    $series = new Series($conf, $series_path, $app_base_url, $start, $end);
    $formats = $conf->getFormats();
    $fmt = $formats['thumb'];
    $thumbs = $series->getThumbs($fmt);
    echo json_encode($thumbs);
});
Exemple #3
0
 $start = $request->params('s');
 if (trim($start) === '') {
     $start = null;
 }
 $end = $request->params('e');
 if (trim($end) === '') {
     $end = null;
 }
 if ($start === null && $end !== null || $start !== null && $end === null) {
     $start = null;
     $end = null;
     throw new \RuntimeException(_('Sub series cannot be instancied; missing one of start or end param!'));
 }
 $series = null;
 try {
     $series = new Series($conf, implode('/', $path), $app_base_url, $start, $end);
 } catch (\RuntimeException $e) {
     Analog::log(_('Cannot load series: ') . $e->getMessage(), Analog::ERROR);
     $app->pass();
 }
 //check if series has content, throw an error if not
 if ($series->getCount() === 0) {
     throw new \RuntimeException(str_replace('%s', $series->getPath(), _('Series "%s" is empty!')));
 }
 $img = null;
 if ($request->params('img') !== null) {
     //get image from its name
     if ($series->setImage($request->params('img'))) {
         $img = $series->getImage();
     }
 } else {
Exemple #4
0
 /**
  * Test subseries
  *
  * @return void
  */
 public function testSubseries()
 {
     $series = new Viewer\Series($this->_conf, '/', null, 'doms.jpg', 'tech.jpg');
     $start = $series->getStart();
     $this->string($start)->isIdenticalTo('doms.jpg');
     $end = $series->getEnd();
     $this->string($end)->isIdenticalTo('tech.jpg');
 }