]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/Images/DrawioImageController.php
Replaced embeds with images in exports
[bookstack] / app / Http / Controllers / Images / DrawioImageController.php
index cab1c925e414855a3a8be13b08e2c825dc101360..31c375c25beee3500c0e439b6a4a0c78262403aa 100644 (file)
@@ -76,8 +76,11 @@ class DrawioImageController extends Controller
             return $this->jsonError('Image data could not be found');
         }
 
+        $isSvg = strtolower(pathinfo($image->path, PATHINFO_EXTENSION)) === 'svg';
+        $uriPrefix = $isSvg ? 'data:image/svg+xml;base64,' : 'data:image/png;base64,';
+
         return response()->json([
-            'content' => base64_encode($imageData),
+            'content' => $uriPrefix . base64_encode($imageData),
         ]);
     }
 }