Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/PhpWord/Shared/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -656,14 +656,12 @@ private static function parseImage($node, $element)
}
}
if (strpos($src, 'data:image') !== false) {
if (!is_dir(self::$imgdir)) {
mkdir(self::$imgdir);
}
$tmpDir = Settings::getTempDir() . '/';

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

$src = $imgFile = self::$imgdir . uniqid() . '.' . $match[1];
$src = $imgFile = $tmpDir . uniqid() . '.' . $match[1];

$ifp = fopen($imgFile, 'wb');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Expand All @@ -682,9 +680,6 @@ private static function parseImage($node, $element)
if (!is_file($src)) {
if ($imgBlob = file_get_contents($src)) {
$tmpDir = Settings::getTempDir() . '/';
if (!is_dir($tmpDir)) {
mkdir($tmpDir);
}
$match = array();
preg_match('/.+\.(\w+)$/', $src, $match);
$src = $tmpDir . uniqid() . '.' . $match[1];
Expand Down
Loading