Commit 17d80642 authored by Andrew Gibiansky's avatar Andrew Gibiansky

Merge pull request #517 from mgomezch/diagrams-binary-readfile

Use readFile from ByteString to read binary files
parents cb55d6b1 df38a542
......@@ -34,11 +34,11 @@ diagramData renderable format = do
renderCairo filename (mkSizeSpec2D (Just imgWidth) (Just imgHeight)) renderable
-- Convert to base64.
imgData <- readFile filename
imgData <- Char.readFile filename
let value =
case format of
PNG -> png (floor imgWidth) (floor imgHeight) $ base64 (Char.pack imgData)
SVG -> svg imgData
PNG -> png (floor imgWidth) (floor imgHeight) $ base64 imgData
SVG -> svg (Char.unpack imgData)
return value
......
......@@ -48,8 +48,8 @@ animationData renderable = do
mainRender (diagOpts, gifOpts) frameSet
-- Convert to ascii represented base64 encoding
imgData <- readFile filename
return . T.unpack . base64 . CBS.pack $ imgData
imgData <- CBS.readFile filename
return . T.unpack . base64 $ imgData
-- Rendering hint.
animation :: Animation Cairo V2 Double -> Animation Cairo V2 Double
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment