I\'m writing my first Yesod app. The application involves the user selecting to view a graph, dynamically generated based on data stored in a DB on the server. I know how to get
For a file on disk, you can use sendFile in your handler.
getImageR = do
-- ... save image data to disk somewhere
sendFile typeJpeg "/path/to/file.jpg"
For sending it from a ByteString
in memory, use sendResponse.
getImageR = do
bytes <- -- generate image data
sendResponse (typePng, toContent bytes)
Make sure you specify the correct content type for your image.