]> BookStack Code Mirror - bookstack/blobdiff - app/Repos/ImageRepo.php
Added Swedish locale to config
[bookstack] / app / Repos / ImageRepo.php
index 435b8bbd795666bddc12d1b8e0e687eecb4bcb8b..5f04a74b19ab9dd938a3655ec94506aca56b099a 100644 (file)
@@ -5,6 +5,7 @@ use BookStack\Image;
 use BookStack\Page;
 use BookStack\Services\ImageService;
 use BookStack\Services\PermissionService;
+use Illuminate\Contracts\Filesystem\FileNotFoundException;
 use Setting;
 use Symfony\Component\HttpFoundation\File\UploadedFile;
 
@@ -182,7 +183,6 @@ class ImageRepo
      * Get the thumbnail for an image.
      * If $keepRatio is true only the width will be used.
      * Checks the cache then storage to avoid creating / accessing the filesystem on every check.
-     *
      * @param Image $image
      * @param int $width
      * @param int $height
@@ -191,7 +191,12 @@ class ImageRepo
      */
     public function getThumbnail(Image $image, $width = 220, $height = 220, $keepRatio = false)
     {
-        return $this->imageService->getThumbnail($image, $width, $height, $keepRatio);
+        try {
+            return $this->imageService->getThumbnail($image, $width, $height, $keepRatio);
+        } catch (\Exception $exception) {
+            dd($exception);
+            return null;
+        }
     }