]> BookStack Code Mirror - bookstack/blobdiff - app/Uploads/ImageRepo.php
Minor capitalisation fix for Estonian
[bookstack] / app / Uploads / ImageRepo.php
index 11507856140a0a7c330991cb8c488a1167257170..c4205e35740d0fce777ac8fd0c358b241dedfd49 100644 (file)
@@ -16,6 +16,8 @@ class ImageRepo
     protected $restrictionService;
     protected $page;
 
+    protected static $supportedExtensions = ['jpg', 'jpeg', 'png', 'gif', 'webp'];
+
     /**
      * ImageRepo constructor.
      */
@@ -31,6 +33,14 @@ class ImageRepo
         $this->page = $page;
     }
 
+    /**
+     * Check if the given image extension is supported by BookStack.
+     */
+    public function imageExtensionSupported(string $extension): bool
+    {
+        return in_array(trim($extension, '. \t\n\r\0\x0B'), static::$supportedExtensions);
+    }
+
     /**
      * Get an image with the given id.
      */