summaryrefslogtreecommitdiff
path: root/lib/VNWeb
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2021-07-07 10:26:16 +0200
committerYorhel <git@yorhel.nl>2021-07-07 10:26:18 +0200
commit289860cdc521ca4bd2bc03b4a2d58ec3c9f23543 (patch)
tree82c7828a81e33e1af887f66b50080f52cf4d3ebc /lib/VNWeb
parent0e7877ce6ad23a2ee9e1cbc0f53cb5745a0739d1 (diff)
Image::Upload: Add support for WebP images
Requires imagemagick built with webp support, of course. They're still converted to JPEG, because I don't think the size/compatibility trade-off is worth it.
Diffstat (limited to 'lib/VNWeb')
-rw-r--r--lib/VNWeb/Images/Upload.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/VNWeb/Images/Upload.pm b/lib/VNWeb/Images/Upload.pm
index 2dbe4db7..312ffcac 100644
--- a/lib/VNWeb/Images/Upload.pm
+++ b/lib/VNWeb/Images/Upload.pm
@@ -14,7 +14,7 @@ TUWF::post qr{/elm/ImageUpload.json}, sub {
my $type = tuwf->validate(post => type => { enum => [qw/cv ch sf/] })->data;
my $imgdata = tuwf->reqUploadRaw('img');
- return elm_ImgFormat if $imgdata !~ /^(\xff\xd8|\x89\x50)/; # JPG or PNG header
+ return elm_ImgFormat if $imgdata !~ /^(\xff\xd8|\x89\x50|RIFF....WEBP)/s; # JPG, PNG or WebP header
my $seq = {qw/sf screenshots_seq cv covers_seq ch charimg_seq/}->{$type}||die;
my $id = tuwf->dbVali('INSERT INTO images', {