| 1 | <?php |
||
| 7 | class Image extends AbstractBackground |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | public $relationId; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Path |
||
| 16 | * |
||
| 17 | * @var string |
||
| 18 | */ |
||
| 19 | protected $path; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var int |
||
| 23 | */ |
||
| 24 | protected $height; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var int |
||
| 28 | */ |
||
| 29 | protected $width; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Get Path |
||
| 33 | * |
||
| 34 | * @return string |
||
| 35 | */ |
||
| 36 | 2 | public function getPath() |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Set Path |
||
| 43 | * |
||
| 44 | * @param string $pValue File path |
||
| 45 | * @param boolean $pVerifyFile Verify file |
||
| 46 | * @throws \Exception |
||
| 47 | * @return \PhpOffice\PhpPresentation\Shape\Drawing |
||
| 48 | */ |
||
| 49 | 2 | public function setPath($pValue = '', $pVerifyFile = true) |
|
| 50 | { |
||
| 51 | 2 | if ($pVerifyFile) { |
|
| 52 | 2 | if (!file_exists($pValue)) { |
|
| 53 | throw new \Exception("File $pValue not found!"); |
||
| 54 | } |
||
| 55 | |||
| 56 | 2 | if ($this->width == 0 && $this->height == 0) { |
|
| 57 | // Get width/height |
||
| 58 | 2 | list($this->width, $this->height) = getimagesize($pValue); |
|
| 59 | } |
||
| 60 | } |
||
| 61 | 2 | $this->path = $pValue; |
|
| 62 | 2 | return $this; |
|
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Get Filename |
||
| 67 | * |
||
| 68 | * @return string |
||
| 69 | */ |
||
| 70 | 1 | public function getFilename() |
|
| 74 | |||
| 75 | /** |
||
| 76 | * Get Extension |
||
| 77 | * |
||
| 78 | * @return string |
||
| 79 | */ |
||
| 80 | 2 | public function getExtension() |
|
| 86 | |||
| 87 | /** |
||
| 88 | * Get indexed filename (using image index) |
||
| 89 | * |
||
| 90 | * @return string |
||
| 91 | */ |
||
| 92 | 2 | public function getIndexedFilename($numSlide) |
|
| 96 | } |
||
| 97 |