increased test coverage of new lines

This commit is contained in:
Javier Garcia 2018-05-24 07:19:45 +02:00
parent a228811a61
commit 46b7bea097
2 changed files with 18 additions and 7 deletions

View File

@ -656,14 +656,12 @@ class Html
} }
} }
if (strpos($src, 'data:image') !== false) { if (strpos($src, 'data:image') !== false) {
if (!is_dir(self::$imgdir)) { $tmpDir = Settings::getTempDir() . '/';
mkdir(self::$imgdir);
}
$match = array(); $match = array();
preg_match('/data:image\/(\w+);base64,(.+)/', $src, $match); 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'); $ifp = fopen($imgFile, 'wb');
@ -682,9 +680,6 @@ class Html
if (!is_file($src)) { if (!is_file($src)) {
if ($imgBlob = file_get_contents($src)) { if ($imgBlob = file_get_contents($src)) {
$tmpDir = Settings::getTempDir() . '/'; $tmpDir = Settings::getTempDir() . '/';
if (!is_dir($tmpDir)) {
mkdir($tmpDir);
}
$match = array(); $match = array();
preg_match('/.+\.(\w+)$/', $src, $match); preg_match('/.+\.(\w+)$/', $src, $match);
$src = $tmpDir . uniqid() . '.' . $match[1]; $src = $tmpDir . uniqid() . '.' . $match[1];

File diff suppressed because one or more lines are too long