Exemplo n.º 1
0
 }
 $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 {
     if ($request->get('num') !== null) {
         //get image from its position
         if ($series->setNumberedImage($request->params('num'))) {
             $img = $series->getImage();
         }
     }
 }
 if ($img === null) {
     $img = $series->getRepresentative();
 }
 $picture = new Picture($conf, $img, $app_base_url, $series->getFullPath());
 $args = array('img' => $img, 'picture' => $picture, 'iip' => $picture->isPyramidal(), 'series' => $series);
Exemplo n.º 2
0
});
$app->get('/ajax/representative/:series/format/:format', function ($series_path = null, $format) 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);
    $picture = new Picture($conf, $series->getRepresentative(), $app_base_url, $series->getFullPath());
    $app->redirect($picture->getUrl($series, $format));
});
$app->get('/ajax/series/infos/:series/:image', function ($series_path, $img) 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);
    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;
    }