Commit 06cae2fa authored by Bas Lijnse's avatar Bas Lijnse

Updated broken JPEG picture extension

parent b3e9cb5c
Pipeline #35761 failed with stage
in 51 seconds
definition module iTasks.Extensions.Picture.Interaction
import iTasks
import iTasks.Extensions.Picture.JPEG
showJPEGPicture :: JPEGPicture -> Task (Maybe JPEGPicture)
implementation module iTasks.Extensions.Picture.Interaction
import iTasks
import iTasks.API.Core.Client.Tasklet
import iTasks.Extensions.Picture.JPEG
showJPEGPicture :: JPEGPicture -> Task (Maybe JPEGPicture)
showJPEGPicture photo
= mkTask (showJPEGPictureTasklet photo)
showJPEGPictureTasklet :: JPEGPicture -> Tasklet (Maybe JPEGPicture) (Maybe JPEGPicture)
showJPEGPictureTasklet picture
=
{ genUI = showJPEGPictureGUI picture
, resultFunc = \_ -> Value (Just picture) True
, tweakUI = setTitle "Picture"
}
where
showJPEGPictureGUI picture _ _ iworld
# gui = { width = WrapSize
, height = WrapSize
, html = RawText htmlText
, eventHandlers = []
}
= (TaskletHTML gui, Nothing, iworld)
htmlText :: String
htmlText = "<img style='max-width: 300px;' src='data:image/jpg;base64," +++ picture +++ "' alt='no photo' />"
......@@ -21,5 +21,7 @@ derive JSONEncode JPEGPicture
derive JSONDecode JPEGPicture
derive gEq JPEGPicture
gEditor{|JPEGPicture|} = comapEditorValue (\(JPEGPicture val) -> ImgTag [SrcAttr val, AltAttr "no photo", StyleAttr ("max-width: 200px; max-height: 200px;")])
htmlView
gEditor{|JPEGPicture|}
= comapEditorValue (\(JPEGPicture val) -> ImgTag
[SrcAttr ("data:image/jpg;base64,"+++val), AltAttr "no photo", StyleAttr ("max-width: 200px; max-height: 200px;")])
htmlView
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