Skip to content

Commit 46b7bea

Browse files
author
Javier Garcia
committed
increased test coverage of new lines
1 parent a228811 commit 46b7bea

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

src/PhpWord/Shared/Html.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -656,14 +656,12 @@ private static function parseImage($node, $element)
656656
}
657657
}
658658
if (strpos($src, 'data:image') !== false) {
659-
if (!is_dir(self::$imgdir)) {
660-
mkdir(self::$imgdir);
661-
}
659+
$tmpDir = Settings::getTempDir() . '/';
662660

663661
$match = array();
664662
preg_match('/data:image\/(\w+);base64,(.+)/', $src, $match);
665663

666-
$src = $imgFile = self::$imgdir . uniqid() . '.' . $match[1];
664+
$src = $imgFile = $tmpDir . uniqid() . '.' . $match[1];
667665

668666
$ifp = fopen($imgFile, 'wb');
669667

@@ -682,9 +680,6 @@ private static function parseImage($node, $element)
682680
if (!is_file($src)) {
683681
if ($imgBlob = file_get_contents($src)) {
684682
$tmpDir = Settings::getTempDir() . '/';
685-
if (!is_dir($tmpDir)) {
686-
mkdir($tmpDir);
687-
}
688683
$match = array();
689684
preg_match('/.+\.(\w+)$/', $src, $match);
690685
$src = $tmpDir . uniqid() . '.' . $match[1];

0 commit comments

Comments
 (0)