. */ namespace Fisharebest\Webtrees\Report; /** * Class ReportHtmlImage */ class ReportHtmlImage extends ReportBaseImage { /** * Image renderer * * @param ReportHtml $renderer */ public function render($renderer) { global $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright; // Get the current positions if ($this->x == '.') { $this->x = $renderer->getX(); } if ($this->y == '.') { //-- first check for a collision with the last picture if (isset($lastpicbottom)) { if (($renderer->pageNo() == $lastpicpage) && ($lastpicbottom >= $renderer->getY()) && ($this->x >= $lastpicleft) && ($this->x <= $lastpicright)) { $renderer->setY($lastpicbottom + ($renderer->cPadding * 2)); } } $this->y = $renderer->getY(); } // Image alignment switch ($this->align) { case 'L': echo '
\n"; echo '\"\"\n
\n"; break; case 'C': echo '
\n"; echo '\"\"\n
\n"; break; case 'R': echo '
\n"; echo '\"\"\n
\n"; break; default: echo '\"\"\n"; } $lastpicpage = $renderer->pageNo(); $lastpicleft = $this->x; $lastpicright = $this->x + $this->width; $lastpicbottom = $this->y + $this->height; // Setup for the next line if ($this->line == 'N') { $renderer->setY($lastpicbottom); } // Keep max Y updated $renderer->addMaxY($lastpicbottom); } /** * Get the image height * This would be called from the TextBox only for multiple images * so we add a bit bottom space between the images * * @param ReportHtml $html * * @return float */ public function getHeight($html): float { return $this->height + ($html->cPadding * 2); } }