X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/080acf0a6234952b4eac1df59e9c11d3be04074b..refs/pull/236/head:/app/Services/ExportService.php diff --git a/app/Services/ExportService.php b/app/Services/ExportService.php index 0497681e9..14084d320 100644 --- a/app/Services/ExportService.php +++ b/app/Services/ExportService.php @@ -48,11 +48,13 @@ class ExportService foreach ($imageTagsOutput[0] as $index => $imgMatch) { $oldImgString = $imgMatch; $srcString = $imageTagsOutput[2][$index]; - if (strpos(trim($srcString), 'http') !== 0) { - $pathString = public_path($srcString); + $isLocal = strpos(trim($srcString), 'http') !== 0; + if ($isLocal) { + $pathString = public_path(trim($srcString, '/')); } else { $pathString = $srcString; } + if ($isLocal && !file_exists($pathString)) continue; $imageContent = file_get_contents($pathString); $imageEncoded = 'data:image/' . pathinfo($pathString, PATHINFO_EXTENSION) . ';base64,' . base64_encode($imageContent); $newImageString = str_replace($srcString, $imageEncoded, $oldImgString);