/** * Test image properties * * @return void */ public function testImageProperties() { $picture = new Viewer\Picture($this->_conf, $this->_series->getRepresentative(), null); $width = $picture->getWidth(); $height = $picture->getHeight(); $isPyramidal = $picture->isPyramidal(); $fpath = $picture->getFullPath(); $vformats = $picture->getVisibleFormats(); $url = $picture->getUrl(null); $surl = $picture->getUrl(null, 'default'); $name = $picture->getName(); $this->integer($width)->isEqualTo(150); $this->integer($height)->isEqualTo(200); $this->boolean($isPyramidal)->isFalse(); $this->string($fpath)->isIdenticalTo($this->_roots[0] . '/doms.jpg'); $this->string($name)->isIdenticalTo('doms.jpg'); $this->array($vformats)->hasSize(1); $this->string($url)->isIdenticalTo('/show/default/doms.jpg'); $this->string($surl)->isIdenticalTo('/show/default/doms.jpg'); $picture = new Viewer\Picture($this->_conf, DEFAULT_PICTURE, null); $width = $picture->getWidth(); $height = $picture->getHeight(); $isPyramidal = $picture->isPyramidal(); $fpath = $picture->getFullPath(); $vformats = $picture->getVisibleFormats(); $url = $picture->getUrl(null); $surl = $picture->getUrl(null, 'default'); $name = $picture->getName(); $this->integer($width)->isEqualTo(3090); $this->integer($height)->isEqualTo(4277); $this->boolean($isPyramidal)->isFalse(); $this->string($fpath)->isIdenticalTo(WEB_DIR . '/images/' . DEFAULT_PICTURE); $this->string($name)->isIdenticalTo(DEFAULT_PICTURE); $this->array($vformats)->hasSize(3); $this->string($url)->isIdenticalTo('/show/default/main.jpg'); $this->string($surl)->isIdenticalTo('/show/default/main.jpg'); }
} $response->body($display['content']); }); $app->get('/viewer/:image_params+', function ($img_params) use($app, $conf, $app_base_url) { $img = array_pop($img_params); $path = null; if (count($img_params) > 0) { $path = '/' . implode('/', $img_params); } $picture = null; if ($img === DEFAULT_PICTURE) { $picture = new Picture($conf, DEFAULT_PICTURE, $app_base_url); } else { $picture = new Picture($conf, $img, $app_base_url, $path); } $args = array('img' => $img, 'picture' => $picture, 'iip' => $picture->isPyramidal()); 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('/print/:format(/:series)/:image(/:display)', function ($format, $series_path, $image, $display = false) use($app, $conf, $viewer) { $picture = $viewer->getImage($series_path, $image); $params = $viewer->bind($app->request); $pdf = new Pdf($conf, $picture, $params, $format);
/** * Get list of cseries thumbnails * * @param array $fmt Thumbnail format form configuration * * @return array */ public function getThumbs($fmt) { $ret = array(); $thumbs = array(); $ret['meta'] = $fmt; foreach ($this->_content as $c) { $p = new Picture($this->_conf, $c, null, $this->_full_path); $path = null; if ($p->isPyramidal()) { $path = $p->getFullPath(); } else { $path = $c; } $thumbs[] = array('name' => $c, 'path' => $path); } $ret['thumbs'] = $thumbs; return $ret; }