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,17 +145,19 @@ 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
|
"image/svg+xml" -> do
|
||||||
Left err -> -- This branch contains svg and other data formats. to be extended for pdf et al.
|
svg <- liftIO $ loadSvgFile path
|
||||||
case mime of
|
(img, _) <- liftIO $ renderSvgDocument emptyFontCache Nothing 100 $ fromJust svg
|
||||||
"image/svg+xml" -> do
|
return img
|
||||||
svg <- liftIO $ loadSvgFile path
|
_ -> do
|
||||||
(img, _) <- liftIO $ renderSvgDocument emptyFontCache Nothing 100 $ fromJust svg
|
eimg <- liftIO $ readImage path
|
||||||
return img
|
case eimg of
|
||||||
_ -> error err
|
Left err ->
|
||||||
Right img -> do -- This branch contains "classical" image formats like bmp or png
|
error err
|
||||||
return $ convertRGBA8 img
|
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"
|
let thumbName = FP.takeBaseName path ++ "_thumb.png"
|
||||||
prevName = FP.takeBaseName path ++ "_preview.png"
|
prevName = FP.takeBaseName path ++ "_preview.png"
|
||||||
pathPrefix = "static" FP.</> "data" FP.</> T.unpack (extractKey uId) FP.</> T.unpack (extractKey aId)
|
pathPrefix = "static" FP.</> "data" FP.</> T.unpack (extractKey uId) FP.</> T.unpack (extractKey aId)
|
||||||
|
|
|
@ -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