X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/b7476a9e7fc27c27342a0a155ab256a93f19981e..refs/pull/5689/head:/app/Uploads/ImageService.php diff --git a/app/Uploads/ImageService.php b/app/Uploads/ImageService.php index 5c455cf86..a8f144517 100644 --- a/app/Uploads/ImageService.php +++ b/app/Uploads/ImageService.php @@ -13,7 +13,7 @@ use Symfony\Component\HttpFoundation\StreamedResponse; class ImageService { - protected static array $supportedExtensions = ['jpg', 'jpeg', 'png', 'gif', 'webp']; + protected static array $supportedExtensions = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'avif']; public function __construct( protected ImageStorage $storage, @@ -31,11 +31,12 @@ class ImageService UploadedFile $uploadedFile, string $type, int $uploadedTo = 0, - int $resizeWidth = null, - int $resizeHeight = null, - bool $keepRatio = true + ?int $resizeWidth = null, + ?int $resizeHeight = null, + bool $keepRatio = true, + string $imageName = '', ): Image { - $imageName = $uploadedFile->getClientOriginalName(); + $imageName = $imageName ?: $uploadedFile->getClientOriginalName(); $imageData = file_get_contents($uploadedFile->getRealPath()); if ($resizeWidth !== null || $resizeHeight !== null) {