diff options
author | Yorhel <git@yorhel.nl> | 2021-07-07 10:26:16 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2021-07-07 10:26:18 +0200 |
commit | 289860cdc521ca4bd2bc03b4a2d58ec3c9f23543 (patch) | |
tree | 82c7828a81e33e1af887f66b50080f52cf4d3ebc /elm | |
parent | 0e7877ce6ad23a2ee9e1cbc0f53cb5745a0739d1 (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 'elm')
-rw-r--r-- | elm/CharEdit.elm | 4 | ||||
-rw-r--r-- | elm/Lib/Api.elm | 2 | ||||
-rw-r--r-- | elm/VNEdit.elm | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/elm/CharEdit.elm b/elm/CharEdit.elm index f652dddd..57a870a1 100644 --- a/elm/CharEdit.elm +++ b/elm/CharEdit.elm @@ -240,7 +240,7 @@ update msg model = MainSpoil n -> ({ model | mainSpoil = n }, Cmd.none) ImageSet s b -> let (nm, nc) = Img.new b s in ({ model | image = nm }, Cmd.map ImageMsg nc) - ImageSelect -> (model, FSel.file ["image/png", "image/jpg"] ImageSelected) + ImageSelect -> (model, FSel.file ["image/png", "image/jpg", "image/webp"] ImageSelected) ImageSelected f -> let (nm, nc) = Img.upload Api.Ch f in ({ model | image = nm }, Cmd.map ImageMsg nc) ImageMsg m -> let (nm, nc) = Img.update m model.image in ({ model | image = nm }, Cmd.map ImageMsg nc) @@ -390,7 +390,7 @@ view model = , h2 [] [ text "Upload new image" ] , inputButton "Browse image" ImageSelect [] , br [] [] - , text "Image must be in JPEG or PNG format and at most 10 MiB. Images larger than 256x300 will automatically be resized." + , text "Image must be in JPEG, PNG or WebP format and at most 10 MiB. Images larger than 256x300 will automatically be resized." , case Img.viewVote model.image ImageMsg (Invalid Image) of Nothing -> text "" Just v -> diff --git a/elm/Lib/Api.elm b/elm/Lib/Api.elm index 514ac6d2..fec77dbd 100644 --- a/elm/Lib/Api.elm +++ b/elm/Lib/Api.elm @@ -44,7 +44,7 @@ showResponse res = DoubleIP -> "You can only register one account from the same IP within 24 hours." BadCurPass -> "Current password is invalid." MailChange -> unexp - ImgFormat -> "Unrecognized image format, only JPEG and PNG are accepted." + ImgFormat -> "Unrecognized image format, only JPEG, PNG and WebP are accepted." DupNames _ -> "Name or alias already in the database." Releases _ -> unexp Resolutions _ -> unexp diff --git a/elm/VNEdit.elm b/elm/VNEdit.elm index 26ea42ea..68aa4c79 100644 --- a/elm/VNEdit.elm +++ b/elm/VNEdit.elm @@ -250,7 +250,7 @@ update msg model = else ({ model | animeSearch = A.clear nm "", anime = model.anime ++ [{ aid = a.id, title = a.title, original = a.original }] }, c) ImageSet s b -> let (nm, nc) = Img.new b s in ({ model | image = nm }, Cmd.map ImageMsg nc) - ImageSelect -> (model, FSel.file ["image/png", "image/jpg"] ImageSelected) + ImageSelect -> (model, FSel.file ["image/png", "image/jpg", "image/webp"] ImageSelected) ImageSelected f -> let (nm, nc) = Img.upload Api.Cv f in ({ model | image = nm }, Cmd.map ImageMsg nc) ImageMsg m -> let (nm, nc) = Img.update m model.image in ({ model | image = nm }, Cmd.map ImageMsg nc) @@ -274,7 +274,7 @@ update msg model = Just s -> ({ model | seiyuuSearch = A.clear nm "", seiyuu = model.seiyuu ++ [{ id = s.id, aid = s.aid, name = s.name, original = s.original, cid = model.seiyuuDef, note = "" }] }, c) ScrUplRel s -> ({ model | scrUplRel = s }, Cmd.none) - ScrUplSel -> (model, FSel.files ["image/png", "image/jpg"] ScrUpl) + ScrUplSel -> (model, FSel.files ["image/png", "image/jpg", "image/webp"] ScrUpl) ScrUpl f1 fl -> if 1 + List.length fl > 10 - List.length model.screenshots then ({ model | scrUplNum = Just (1 + List.length fl) }, Cmd.none) @@ -413,7 +413,7 @@ view model = , h2 [] [ text "Upload new image" ] , inputButton "Browse image" ImageSelect [] , br [] [] - , text "Preferably the cover of the CD/DVD/package. Image must be in JPEG or PNG format and at most 10 MiB. Images larger than 256x400 will automatically be resized." + , text "Preferably the cover of the CD/DVD/package. Image must be in JPEG, PNG or WebP format and at most 10 MiB. Images larger than 256x400 will automatically be resized." , case Img.viewVote model.image ImageMsg (Invalid Image) of Nothing -> text "" Just v -> |