/** * Main constructor * * @param Conf $conf App Configuration * @param Picture $picture Picture * @param array $params Print params * @param string $format Image format */ public function __construct(Conf $conf, Picture $picture, $params, $format) { $orientation = 'P'; $w = $picture->getWidth(); $h = $picture->getHeight(); if ($params['crop'] !== false) { if ($params['crop']['w'] < $w) { $w = $params['crop']['w']; } if ($params['crop']['h']) { $h = $params['crop']['h']; } } if ($w > $h) { $orientation = 'L'; } parent::__construct($orientation, 'mm', 'A4', true, 'UTF-8'); $this->_conf = $conf; $this->_picture = $picture; $this->_params = $params; $this->_image_format = $format; $this->setCreator('Bach - ' . PDF_CREATOR); $this->setTitle($picture->getName()); }
/** * 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'); }