Bookstack: Attempt to upload BMP image as book cover causes crash

Created on 31 Mar 2020  路  4Comments  路  Source: BookStackApp/BookStack

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()
Bug Back-End

Most helpful comment

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.

All 4 comments

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.

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.

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Abijeet picture Abijeet  路  3Comments

marcvef picture marcvef  路  3Comments

conor-byrne picture conor-byrne  路  3Comments

Nedimko123 picture Nedimko123  路  3Comments

Legoracers picture Legoracers  路  3Comments