proper handling of gif and svg

This commit is contained in:
nek0 2015-08-20 01:42:17 +02:00
parent 932dc3539f
commit 5a7f6c7eb9
2 changed files with 4 additions and 2 deletions

View file

@ -133,12 +133,14 @@ generateThumb path userId albumId = do
FP.</> newName FP.</> newName
(iWidth, tWidth) <- liftIO $ withMagickWandGenesis $ do (iWidth, tWidth) <- liftIO $ withMagickWandGenesis $ do
(_ , w) <- magickWand (_ , w) <- magickWand
setImageFormat w "jpeg" p <- pixelWand
readImage w (decodeString path) readImage w (decodeString path)
w1 <- getImageWidth w w1 <- getImageWidth w
h1 <- getImageHeight w h1 <- getImageHeight w
h2 <- return 230 h2 <- return 230
w2 <- return $ floor (((fromIntegral w1) / (fromIntegral h1)) * (fromIntegral h2) :: Double) w2 <- return $ floor (((fromIntegral w1) / (fromIntegral h1)) * (fromIntegral h2) :: Double)
setImageAlphaChannel w deactivateAlphaChannel
setImageFormat w "jpeg"
resizeImage w w2 h2 lanczosFilter 1 resizeImage w w2 h2 lanczosFilter 1
setImageCompressionQuality w 95 setImageCompressionQuality w 95
writeImage w (Just (decodeString newPath)) writeImage w (Just (decodeString newPath))

View file

@ -148,7 +148,7 @@ reverseLookup s ((x, y):zs)
| otherwise = Nothing | otherwise = Nothing
acceptedTypes :: [T.Text] 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 :: FormatTime t => t -> String
iso8601 time = iso8601 time =