]> BookStack Code Mirror - bookstack/commit
Made display thumbnail generation use original data if smaller
authorDan Brown <redacted>
Sun, 22 Dec 2019 12:44:49 +0000 (12:44 +0000)
committerDan Brown <redacted>
Sun, 22 Dec 2019 12:44:49 +0000 (12:44 +0000)
commit32e7f0a2e672226384f58a0f7ba96e0b17535d4a
tree65bdc04014e72b315f6405580c92bfc0077b4ea6
parenta83a7f34f4d4c85bfb208eb1abfdd77743856680
Made display thumbnail generation use original data if smaller

Thumbnail generation would sometimes create a file larger than the
original, if the original was already well optimized, therefore making
the thumbnail counter-productive. This change compares the sizes of the
original and the generated thumbnail, and uses the smaller of the two if
the thumbnail does not change the aspect ratio of the image.

Fixes #1751
app/Uploads/ImageRepo.php
app/Uploads/ImageService.php
tests/Uploads/ImageTest.php
tests/Uploads/UsesImages.php
tests/test-data/compressed.png [new file with mode: 0644]