proper handling of gif and svg
This commit is contained in:
parent
932dc3539f
commit
5a7f6c7eb9
2 changed files with 4 additions and 2 deletions
|
@ -133,12 +133,14 @@ generateThumb path userId albumId = do
|
|||
FP.</> newName
|
||||
(iWidth, tWidth) <- liftIO $ withMagickWandGenesis $ do
|
||||
(_ , w) <- magickWand
|
||||
setImageFormat w "jpeg"
|
||||
p <- pixelWand
|
||||
readImage w (decodeString path)
|
||||
w1 <- getImageWidth w
|
||||
h1 <- getImageHeight w
|
||||
h2 <- return 230
|
||||
w2 <- return $ floor (((fromIntegral w1) / (fromIntegral h1)) * (fromIntegral h2) :: Double)
|
||||
setImageAlphaChannel w deactivateAlphaChannel
|
||||
setImageFormat w "jpeg"
|
||||
resizeImage w w2 h2 lanczosFilter 1
|
||||
setImageCompressionQuality w 95
|
||||
writeImage w (Just (decodeString newPath))
|
||||
|
|
|
@ -148,7 +148,7 @@ reverseLookup s ((x, y):zs)
|
|||
| otherwise = Nothing
|
||||
|
||||
acceptedTypes :: [T.Text]
|
||||
acceptedTypes = ["image/jpeg", "image/jpg", "image/png", "image/x-ms-bmp", "image/x-bmp", "image/bmp", "image/tiff", "image/tiff-fx"]
|
||||
acceptedTypes = ["image/jpeg", "image/jpg", "image/png", "image/x-ms-bmp", "image/x-bmp", "image/bmp", "image/tiff", "image/tiff-fx", "image/svg+xml", "image/gif"]
|
||||
|
||||
iso8601 :: FormatTime t => t -> String
|
||||
iso8601 time =
|
||||
|
|
Loading…
Reference in a new issue