EPUB writer: Simplify imageTypeOf using getMimeType.
This commit is contained in:
parent
4501344d45
commit
a7067ab22b
1 changed files with 3 additions and 9 deletions
|
@ -736,15 +736,9 @@ ppTopElement = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ++) . unEntity .
|
||||||
unEntity (x:xs) = x : unEntity xs
|
unEntity (x:xs) = x : unEntity xs
|
||||||
|
|
||||||
imageTypeOf :: FilePath -> Maybe String
|
imageTypeOf :: FilePath -> Maybe String
|
||||||
imageTypeOf x = case drop 1 (map toLower (takeExtension x)) of
|
imageTypeOf x = case getMimeType x of
|
||||||
"jpg" -> Just "image/jpeg"
|
Just y@('i':'m':'a':'g':'e':_) -> Just y
|
||||||
"jpeg" -> Just "image/jpeg"
|
_ -> Nothing
|
||||||
"jfif" -> Just "image/jpeg"
|
|
||||||
"png" -> Just "image/png"
|
|
||||||
"gif" -> Just "image/gif"
|
|
||||||
"svg" -> Just "image/svg+xml"
|
|
||||||
_ -> Nothing
|
|
||||||
|
|
||||||
|
|
||||||
data IdentState = IdentState{
|
data IdentState = IdentState{
|
||||||
chapterNumber :: Int,
|
chapterNumber :: Int,
|
||||||
|
|
Loading…
Add table
Reference in a new issue