Attempt to upload BMP image as book cover causes crash #1616

Closed
opened 2026-02-05 01:26:13 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @lpar on GitHub (Mar 31, 2020).

Describe the bug
User attempts to use a .bmp image as a cover image for a book. They get an unhelpful "unknown error" page.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Try to use a .bmp file as the cover of a book.

Expected behavior
A more useful error message and no crash.

Your Configuration (please complete the following information):

  • Exact BookStack Version (Found in settings): BookStack v0.28.3
  • PHP Version: 7.4.4
  • Hosting Method (Nginx/Apache/Docker): lighttpd

Additional context

[2020-03-31 18:09:56] production.ERROR: BMP format is not supported by Gd Driver. {"userId":6,"exception":"[object]
 (Intervention\\Image\\Exception\\NotSupportedException(code: 0): BMP format is not supported by Gd Driver. at /var
/www/BookStack/vendor/intervention/image/src/Intervention/Image/Gd/Encoder.php:96)
[stacktrace]
#0 /var/www/BookStack/vendor/intervention/image/src/Intervention/Image/AbstractEncoder.php(151): Intervention\\Imag
e\\Gd\\Encoder->processBmp()
#1 /var/www/BookStack/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php(79): Intervention\\Image\
\AbstractEncoder->process()
#2 /var/www/BookStack/vendor/intervention/image/src/Intervention/Image/Image.php(121): Intervention\\Image\\Abstrac
tDriver->encode()
#3 /var/www/BookStack/app/Uploads/ImageService.php(258): Intervention\\Image\\Image->encode()
#4 /var/www/BookStack/app/Uploads/ImageService.php(82): BookStack\\Uploads\\ImageService->resizeImage()
#5 /var/www/BookStack/app/Uploads/ImageRepo.php(130): BookStack\\Uploads\\ImageService->saveNewFromUpload()
#6 /var/www/BookStack/app/Entities/Repos/BaseRepo.php(83): BookStack\\Uploads\\ImageRepo->saveNew()
Originally created by @lpar on GitHub (Mar 31, 2020). **Describe the bug** User attempts to use a .bmp image as a cover image for a book. They get an unhelpful "unknown error" page. **Steps To Reproduce** Steps to reproduce the behavior: 1. Try to use a .bmp file as the cover of a book. **Expected behavior** A more useful error message and no crash. **Your Configuration (please complete the following information):** - Exact BookStack Version (Found in settings): BookStack v0.28.3 - PHP Version: 7.4.4 - Hosting Method (Nginx/Apache/Docker): lighttpd **Additional context** ``` [2020-03-31 18:09:56] production.ERROR: BMP format is not supported by Gd Driver. {"userId":6,"exception":"[object] (Intervention\\Image\\Exception\\NotSupportedException(code: 0): BMP format is not supported by Gd Driver. at /var /www/BookStack/vendor/intervention/image/src/Intervention/Image/Gd/Encoder.php:96) [stacktrace] #0 /var/www/BookStack/vendor/intervention/image/src/Intervention/Image/AbstractEncoder.php(151): Intervention\\Imag e\\Gd\\Encoder->processBmp() #1 /var/www/BookStack/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php(79): Intervention\\Image\ \AbstractEncoder->process() #2 /var/www/BookStack/vendor/intervention/image/src/Intervention/Image/Image.php(121): Intervention\\Image\\Abstrac tDriver->encode() #3 /var/www/BookStack/app/Uploads/ImageService.php(258): Intervention\\Image\\Image->encode() #4 /var/www/BookStack/app/Uploads/ImageService.php(82): BookStack\\Uploads\\ImageService->resizeImage() #5 /var/www/BookStack/app/Uploads/ImageRepo.php(130): BookStack\\Uploads\\ImageService->saveNewFromUpload() #6 /var/www/BookStack/app/Entities/Repos/BaseRepo.php(83): BookStack\\Uploads\\ImageRepo->saveNew() ```
OVERLORD added the 🐛 Bug🏭 Back-End labels 2026-02-05 01:26:13 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Apr 1, 2020):

Thanks @lpar for reporting. Can confirm this being an issue, The underlying driver does not support the bmp format. Also causes issues for page content.

Since this is the first time this has been raised, I'm tempted just to removed bmp as a supported image upload extension. Same with tiff.

@ssddanbrown commented on GitHub (Apr 1, 2020): Thanks @lpar for reporting. Can confirm this being an issue, The underlying driver does not support the bmp format. Also causes issues for page content. Since this is the first time this has been raised, I'm tempted just to removed bmp as a supported image upload extension. Same with tiff.
Author
Owner

@lpar commented on GitHub (Apr 1, 2020):

That's what I'd do. No reason people should be using BMP or TIFF files with any web-based application. In fact, BMP files are basically obsolete for all purposes.

@lpar commented on GitHub (Apr 1, 2020): That's what I'd do. No reason people should be using BMP or TIFF files with any web-based application. In fact, BMP files are basically obsolete for all purposes.
Author
Owner

@ssddanbrown commented on GitHub (Apr 2, 2020):

Cool, Have assigned to be addressed in the next feature release.

@ssddanbrown commented on GitHub (Apr 2, 2020): Cool, Have assigned to be addressed in the next feature release.
Author
Owner

@ssddanbrown commented on GitHub (Apr 5, 2020):

Patch now in master, to be in v0.29.0. Thanks again for reporting.

@ssddanbrown commented on GitHub (Apr 5, 2020): Patch now in master, to be in v0.29.0. Thanks again for reporting.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1616