1<?php 2 3/** 4 * webtrees: online genealogy 5 * Copyright (C) 2019 webtrees development team 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17declare(strict_types=1); 18 19namespace Fisharebest\Webtrees\Report; 20 21/** 22 * Class ReportBaseImage 23 */ 24class ReportBaseImage extends ReportBaseElement 25{ 26 /** @var string Filename of the image */ 27 public $file; 28 29 /** @var float Height of the image */ 30 public $height; 31 32 /** @var float Width of the image */ 33 public $width; 34 35 /** @var float X-position (left) of the image */ 36 public $x; 37 38 /** @var float Y-position (top) of the image */ 39 public $y; 40 41 /** @var string Placement fo the image. L: left, C:center, R:right (or empty for x/y) */ 42 public $align; 43 44 /** @var string T:same line, N:next line */ 45 public $line; 46 47 /** 48 * Image class function - Base 49 * 50 * @param string $file Filename of the image 51 * @param float $x X-position (left) of the image 52 * @param float $y Y-position (top) of the image 53 * @param float $w Width of the image 54 * @param float $h Height of the image 55 * @param string $align Placement of the image. L: left, C:center, R:right 56 * @param string $ln T:same line, N:next line 57 */ 58 public function __construct(string $file, float $x, float $y, float $w, float $h, string $align, string $ln) 59 { 60 $this->file = $file; 61 $this->width = $w; 62 $this->height = $h; 63 $this->x = $x; 64 $this->y = $y; 65 $this->align = $align; 66 $this->line = $ln; 67 } 68 69 /** 70 * Get the height. 71 * 72 * @param ReportHtml|ReportTcpdf $renderer 73 * 74 * @return float 75 */ 76 public function getHeight($renderer): float 77 { 78 return $this->height; 79 } 80 81 /** 82 * Get the width. 83 * 84 * @param ReportHtml|ReportTcpdf $renderer 85 * 86 * @return float|array 87 */ 88 public function getWidth($renderer) 89 { 90 return $this->width; 91 } 92} 93