aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/Processors.hs
diff options
context:
space:
mode:
authorpacien2019-12-27 15:40:50 +0100
committerpacien2019-12-27 15:40:50 +0100
commite324f3b776e24a441e2b436da95629f0eadaed3f (patch)
tree1e400797ad67e1acad3b9907a93d999fd3a4a662 /compiler/src/Processors.hs
parenta8cdc6eba4ba496bec816dcb7f3c2c0f5114f4c8 (diff)
downloadldgallery-e324f3b776e24a441e2b436da95629f0eadaed3f.tar.gz
compiler: make extension case insensitive
Diffstat (limited to 'compiler/src/Processors.hs')
-rw-r--r--compiler/src/Processors.hs19
1 files changed, 11 insertions, 8 deletions
diff --git a/compiler/src/Processors.hs b/compiler/src/Processors.hs
index c097db7..7bf1e36 100644
--- a/compiler/src/Processors.hs
+++ b/compiler/src/Processors.hs
@@ -35,6 +35,7 @@ module Processors
35import Control.Exception (throwIO) 35import Control.Exception (throwIO)
36import Data.Function ((&)) 36import Data.Function ((&))
37import Data.Ratio ((%)) 37import Data.Ratio ((%))
38import Data.Char (toLower)
38 39
39import GHC.Generics (Generic) 40import GHC.Generics (Generic)
40import Data.Aeson (FromJSON) 41import Data.Aeson (FromJSON)
@@ -56,14 +57,16 @@ data Format =
56 | Other 57 | Other
57 58
58formatFromExt :: String -> Format 59formatFromExt :: String -> Format
59formatFromExt ".bmp" = Bmp 60formatFromExt = aux . (map toLower)
60formatFromExt ".jpg" = Jpg 61 where
61formatFromExt ".jpeg" = Jpg 62 aux ".bmp" = Bmp
62formatFromExt ".png" = Png 63 aux ".jpg" = Jpg
63formatFromExt ".tiff" = Tiff 64 aux ".jpeg" = Jpg
64formatFromExt ".hdr" = Hdr 65 aux ".png" = Png
65formatFromExt ".gif" = Gif 66 aux ".tiff" = Tiff
66formatFromExt _ = Other 67 aux ".hdr" = Hdr
68 aux ".gif" = Gif
69 aux _ = Other
67 70
68data Resolution = Resolution 71data Resolution = Resolution
69 { width :: Int 72 { width :: Int