]> BookStack Code Mirror - bookstack/blobdiff - app/Uploads/ImageStorageDisk.php
Lexical: Updated tests for node changes
[bookstack] / app / Uploads / ImageStorageDisk.php
index 3a95661ca6928fb551d797367b10b8a6bf9a4e19..8df702e0d94183b23248a441935e6723d199c4d1 100644 (file)
@@ -50,11 +50,20 @@ class ImageStorageDisk
     /**
      * Get the file at the given path.
      */
-    public function get(string $path): bool
+    public function get(string $path): ?string
     {
         return $this->filesystem->get($this->adjustPathForDisk($path));
     }
 
+    /**
+     * Get a stream to the file at the given path.
+     * @returns ?resource
+     */
+    public function stream(string $path): mixed
+    {
+        return $this->filesystem->readStream($this->adjustPathForDisk($path));
+    }
+
     /**
      * Save the given image data at the given path. Can choose to set
      * the image as public which will update its visibility after saving.
@@ -106,6 +115,7 @@ class ImageStorageDisk
      */
     public function mimeType(string $path): string
     {
+        $path = $this->adjustPathForDisk($path);
         return $this->filesystem instanceof FilesystemAdapter ? $this->filesystem->mimeType($path) : '';
     }
 
@@ -114,7 +124,7 @@ class ImageStorageDisk
      */
     public function response(string $path): StreamedResponse
     {
-        return $this->filesystem->response($path);
+        return $this->filesystem->response($this->adjustPathForDisk($path));
     }
 
     /**