Skip to content

Commit 55e805e

Browse files
committed
PowerPoint2007 Writer : Move to Design Pattern Decorator (PHP 5.3)
1 parent 93f8cef commit 55e805e

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/PhpPresentation/Writer/ODPresentation/Manifest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ private function getImageMimeType($pFile = '')
161161
$pImgFile = substr($pFile, strpos($pFile, '#') + 1);
162162
$oArchive = new \ZipArchive();
163163
$oArchive->open($pZIPFile);
164-
$image = getimagesizefromstring($oArchive->getFromName($pImgFile));
164+
if (!function_exists('getimagesizefromstring')) {
165+
$uri = 'data://application/octet-stream;base64,' . base64_encode($oArchive->getFromName($pImgFile));
166+
$image = getimagesize($uri);
167+
} else {
168+
$image = getimagesizefromstring($oArchive->getFromName($pImgFile));
169+
}
165170
} else {
166171
$image = getimagesize($pFile);
167172
}

src/PhpPresentation/Writer/PowerPoint2007/ContentTypes.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,12 @@ private function getImageMimeType($pFile = '')
180180
$pImgFile = substr($pFile, strpos($pFile, '#') + 1);
181181
$oArchive = new \ZipArchive();
182182
$oArchive->open($pZIPFile);
183-
$image = getimagesizefromstring($oArchive->getFromName($pImgFile));
183+
if (!function_exists('getimagesizefromstring')) {
184+
$uri = 'data://application/octet-stream;base64,' . base64_encode($oArchive->getFromName($pImgFile));
185+
$image = getimagesize($uri);
186+
} else {
187+
$image = getimagesizefromstring($oArchive->getFromName($pImgFile));
188+
}
184189
} else {
185190
if (!File::fileExists($pFile)) {
186191
throw new \Exception("File $pFile does not exist");

0 commit comments

Comments
 (0)