Skip to content

Commit

Permalink
Addressing Compatibility Issues Causing Crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
ag3202 committed Feb 29, 2024
1 parent 668367a commit cdd7142
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/PhpPresentation/Reader/PowerPoint2007.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ protected function loadSlide(string $sPart, string $baseFile): void
// Background
$oBackground = new Slide\Background\Image();
$oBackground->setPath($tmpBkgImg);
$extension = pathinfo( $pathImage, PATHINFO_EXTENSION );
$oBackground->setExtension($extension);
// Slide Background
$oSlide = $this->oPhpPresentation->getActiveSlide();
$oSlide->setBackground($oBackground);
Expand Down
23 changes: 22 additions & 1 deletion src/PhpPresentation/Slide/Background/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ class Image extends AbstractBackground
*/
protected $width;

/**
* @var string
*/
protected $extension;

/**
* Get Path.
*/
Expand Down Expand Up @@ -79,6 +84,19 @@ public function setPath(string $pValue = '', bool $pVerifyFile = true)
return $this;
}

/**
* Set Extension.
*
* @param string $pValue File Extension
*
* @return self
*/
public function setExtension(string $pValue)
{
$this->extension = $pValue;
return $this;
}

/**
* Get Filename.
*/
Expand All @@ -92,9 +110,12 @@ public function getFilename(): string
*/
public function getExtension(): string
{
if($this->extension){
return $this->extension;
}
$exploded = explode('.', $this->getFilename());

return $exploded[count($exploded) - 1];

}

/**
Expand Down

0 comments on commit cdd7142

Please sign in to comment.