]> BookStack Code Mirror - bookstack/blobdiff - app/Services/ExportService.php
Add Carbon localization support
[bookstack] / app / Services / ExportService.php
index 0497681e9ac695204ea7952af02b2ae5e81958fa..14084d320628a7f29e851f5b7a68f1b9a4b810da 100644 (file)
@@ -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);