} $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); if ($picture->isPyramidal()) { $iip = $conf->getIIP(); $args['iipserver'] = $iip['server']; } else { $args['image_format'] = 'default'; } if (file_exists('../web/themes/styles/themes.css')) { $args['themes'] = 'themes'; } $app->render('index.html.twig', $args); });
*/ $app->get('/ajax/img(/:series)/:image(/format/:format)', function ($series_path = null, $image, $format = 'default') use($app, $viewer) { $picture = $viewer->getImage($series_path, $image); $display = $picture->getDisplay($format); $response = $app->response(); foreach ($display['headers'] as $key => $header) { $response[$key] = $header; } $response->body($display['content']); }); $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);