forcing Thumbnails into jpeg format

This commit is contained in:
nek0 2015-08-19 07:47:23 +02:00
parent f0d53ce8b7
commit 932dc3539f

View file

@ -126,13 +126,14 @@ postDirectUploadR albumId = do
generateThumb :: FP.FilePath -> UserId -> AlbumId -> Handler (FP.FilePath, Int, Int) generateThumb :: FP.FilePath -> UserId -> AlbumId -> Handler (FP.FilePath, Int, Int)
generateThumb path userId albumId = do generateThumb path userId albumId = do
newName <- return $ (FP.takeBaseName path) ++ "_thumb" ++ (FP.takeExtension path) newName <- return $ (FP.takeBaseName path) ++ "_thumb.jpg"
newPath <- return $ "static" FP.</> "data" newPath <- return $ "static" FP.</> "data"
FP.</> (T.unpack $ extractKey userId) FP.</> (T.unpack $ extractKey userId)
FP.</> (T.unpack $ extractKey albumId) FP.</> (T.unpack $ extractKey albumId)
FP.</> newName FP.</> newName
(iWidth, tWidth) <- liftIO $ withMagickWandGenesis $ do (iWidth, tWidth) <- liftIO $ withMagickWandGenesis $ do
(_ , w) <- magickWand (_ , w) <- magickWand
setImageFormat w "jpeg"
readImage w (decodeString path) readImage w (decodeString path)
w1 <- getImageWidth w w1 <- getImageWidth w
h1 <- getImageHeight w h1 <- getImageHeight w