]> BookStack Code Mirror - bookstack/commit
Added detection and thumbnail bypass for apng images
authorDan Brown <redacted>
Tue, 4 Jan 2022 13:10:35 +0000 (13:10 +0000)
committerDan Brown <redacted>
Tue, 4 Jan 2022 13:10:35 +0000 (13:10 +0000)
commit31f1dca8a81e70aa8b5598fdaf4af772a28ac9c9
tree4e26020c6e3f02fa12b6c7857d10f556d58fb8c0
parent819ec55b1b87393e26dae0a65c65584cff137135
Added detection and thumbnail bypass for apng images

Adds apng sniffing when generating thumbnails with retained ratios to
serve the original image files, as we do for GIF images, to prevent
the image being resized to a static version.

Is more tricky than GIF since apng file mimes and extensions
are the same as png, we have to detect part of the file header
to sniff the type. Means we have to sniff at a later stage
than GIF since we have to load the image file data.

Made some changes to the image thubmnail caching while doing
this work to fit in with this handling.

Added test to cover.
For #3136.
app/Uploads/ImageService.php
app/Util/WebSafeMimeSniffer.php
tests/Uploads/ImageTest.php
tests/Uploads/UsesImages.php
tests/test-data/animated.png [new file with mode: 0644]