fixed svg upload
This commit is contained in:
parent
88ecfa9487
commit
4c98dcca24
2 changed files with 16 additions and 12 deletions
|
@ -35,6 +35,8 @@ import Graphics.Rasterific.Svg as SVG
|
||||||
import Graphics.Svg
|
import Graphics.Svg
|
||||||
import Graphics.Text.TrueType
|
import Graphics.Text.TrueType
|
||||||
|
|
||||||
|
import Debug.Trace
|
||||||
|
|
||||||
getDirectUploadR :: AlbumId -> Handler Html
|
getDirectUploadR :: AlbumId -> Handler Html
|
||||||
getDirectUploadR albumId = do
|
getDirectUploadR albumId = do
|
||||||
tempAlbum <- runDB $ get albumId
|
tempAlbum <- runDB $ get albumId
|
||||||
|
@ -143,16 +145,18 @@ generateThumbs
|
||||||
-> T.Text -- ^ MIME-Type (used for svg et al.)
|
-> T.Text -- ^ MIME-Type (used for svg et al.)
|
||||||
-> Handler ThumbsMeta -- ^ Resulting metadata to store
|
-> Handler ThumbsMeta -- ^ Resulting metadata to store
|
||||||
generateThumbs path uId aId mime = do
|
generateThumbs path uId aId mime = do
|
||||||
eimg <- liftIO $ readImage path
|
orig <- case mime of
|
||||||
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
|
"image/svg+xml" -> do
|
||||||
svg <- liftIO $ loadSvgFile path
|
svg <- liftIO $ loadSvgFile path
|
||||||
(img, _) <- liftIO $ renderSvgDocument emptyFontCache Nothing 100 $ fromJust svg
|
(img, _) <- liftIO $ renderSvgDocument emptyFontCache Nothing 100 $ fromJust svg
|
||||||
return img
|
return img
|
||||||
_ -> error err
|
_ -> 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
|
Right img -> do -- This branch contains "classical" image formats like bmp or png
|
||||||
|
liftIO $ traceIO "I am here!"
|
||||||
return $ convertRGBA8 img
|
return $ convertRGBA8 img
|
||||||
let thumbName = FP.takeBaseName path ++ "_thumb.png"
|
let thumbName = FP.takeBaseName path ++ "_thumb.png"
|
||||||
prevName = FP.takeBaseName path ++ "_preview.png"
|
prevName = FP.takeBaseName path ++ "_preview.png"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: eidolon
|
name: eidolon
|
||||||
version: 0.1.8.2
|
version: 0.1.8.3
|
||||||
synopsis: Image gallery in Yesod
|
synopsis: Image gallery in Yesod
|
||||||
homepage: https://eidolon.nek0.eu
|
homepage: https://eidolon.nek0.eu
|
||||||
license: AGPL-3
|
license: AGPL-3
|
||||||
|
|
Loading…
Reference in a new issue