From 4c98dcca248a5ee65e83e0528eb7724bcbb5d721 Mon Sep 17 00:00:00 2001 From: nek0 Date: Sat, 7 Jan 2017 23:18:25 +0100 Subject: [PATCH] fixed svg upload --- Handler/Upload.hs | 26 +++++++++++++++----------- eidolon.cabal | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Handler/Upload.hs b/Handler/Upload.hs index d53c16a..9dd5ea5 100755 --- a/Handler/Upload.hs +++ b/Handler/Upload.hs @@ -35,6 +35,8 @@ import Graphics.Rasterific.Svg as SVG import Graphics.Svg import Graphics.Text.TrueType +import Debug.Trace + getDirectUploadR :: AlbumId -> Handler Html getDirectUploadR albumId = do tempAlbum <- runDB $ get albumId @@ -143,17 +145,19 @@ generateThumbs -> T.Text -- ^ MIME-Type (used for svg et al.) -> Handler ThumbsMeta -- ^ Resulting metadata to store generateThumbs path uId aId mime = do - eimg <- liftIO $ readImage path - orig <- case eimg of - Left err -> -- This branch contains svg and other data formats. to be extended for pdf et al. - case mime of - "image/svg+xml" -> do - svg <- liftIO $ loadSvgFile path - (img, _) <- liftIO $ renderSvgDocument emptyFontCache Nothing 100 $ fromJust svg - return img - _ -> error err - Right img -> do -- This branch contains "classical" image formats like bmp or png - return $ convertRGBA8 img + orig <- case mime of + "image/svg+xml" -> do + svg <- liftIO $ loadSvgFile path + (img, _) <- liftIO $ renderSvgDocument emptyFontCache Nothing 100 $ fromJust svg + return img + _ -> do + eimg <- liftIO $ readImage path + case eimg of + Left err -> + error err + Right img -> do -- This branch contains "classical" image formats like bmp or png + liftIO $ traceIO "I am here!" + return $ convertRGBA8 img let thumbName = FP.takeBaseName path ++ "_thumb.png" prevName = FP.takeBaseName path ++ "_preview.png" pathPrefix = "static" FP. "data" FP. T.unpack (extractKey uId) FP. T.unpack (extractKey aId) diff --git a/eidolon.cabal b/eidolon.cabal index e131de4..59049ba 100755 --- a/eidolon.cabal +++ b/eidolon.cabal @@ -1,5 +1,5 @@ name: eidolon -version: 0.1.8.2 +version: 0.1.8.3 synopsis: Image gallery in Yesod homepage: https://eidolon.nek0.eu license: AGPL-3